From: Kinsey Moore Date: Fri, 9 May 2014 22:28:40 +0000 (+0000) Subject: Allow Asterisk to compile under GCC 4.10 X-Git-Tag: 11.10.0-rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abac3330cffe6b94da784bdc0ef72f573e3b286b;p=thirdparty%2Fasterisk.git 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@413587 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 518a02113b..5e7d5f3f64 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -202,7 +202,7 @@ static int process_token(void *out, char *src, int maxlen, int argtype) if (!(argtype & ARG_NUMBER)) return -1; /* Octal value */ - if (sscanf(src, "%30o", (int *)out) != 1) + if (sscanf(src, "%30o", (unsigned *)out) != 1) return -1; if (argtype & ARG_STRING) { /* Convert */ diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index fc44197a9d..553e513517 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -2305,7 +2305,7 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct ast_cli(a->fd, "================================ ====== ====== ========\n"); i = ao2_iterator_init(conference_bridges, 0); while ((bridge = ao2_iterator_next(&i))) { - ast_cli(a->fd, "%-32s %6i %6i %s\n", bridge->name, bridge->activeusers + bridge->waitingusers, bridge->markedusers, (bridge->locked ? "locked" : "unlocked")); + ast_cli(a->fd, "%-32s %6u %6u %s\n", bridge->name, bridge->activeusers + bridge->waitingusers, bridge->markedusers, (bridge->locked ? "locked" : "unlocked")); ao2_ref(bridge, -1); } ao2_iterator_destroy(&i); @@ -2757,8 +2757,8 @@ static int action_confbridgelistrooms(struct mansession *s, const struct message "Event: ConfbridgeListRooms\r\n" "%s" "Conference: %s\r\n" - "Parties: %d\r\n" - "Marked: %d\r\n" + "Parties: %u\r\n" + "Marked: %u\r\n" "Locked: %s\r\n" "\r\n", id_text, diff --git a/apps/app_dial.c b/apps/app_dial.c index 2591049371..69c14f08dc 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1543,7 +1543,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, /* Fall through */ case AST_FRAME_TEXT: if (single && ast_write(in, f)) { - ast_log(LOG_WARNING, "Unable to write frametype: %d\n", + ast_log(LOG_WARNING, "Unable to write frametype: %u\n", f->frametype); } break; @@ -1648,7 +1648,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, case AST_FRAME_DTMF_BEGIN: case AST_FRAME_DTMF_END: if (ast_write(o->chan, f)) { - ast_log(LOG_WARNING, "Unable to forward frametype: %d\n", + ast_log(LOG_WARNING, "Unable to forward frametype: %u\n", f->frametype); } break; diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index c2cff6114c..83ceef5b93 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -103,7 +103,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) "RDNIS= %s\n" "Parkinglot= %s\n" "Language= %s\n" - "State= %s (%d)\n" + "State= %s (%u)\n" "Rings= %d\n" "NativeFormat= %s\n" "WriteFormat= %s\n" @@ -113,8 +113,8 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) "WriteTranscode= %s %s\n" "ReadTranscode= %s %s\n" "1stFileDescriptor= %d\n" - "Framesin= %d %s\n" - "Framesout= %d %s\n" + "Framesin= %u %s\n" + "Framesout= %u %s\n" "TimetoHangup= %ld\n" "ElapsedTime= %dh%dm%ds\n" "DirectBridge= %s\n" diff --git a/apps/app_festival.c b/apps/app_festival.c index d875b7acb7..3f36301d6c 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -415,7 +415,7 @@ static int festival_exec(struct ast_channel *chan, const char *vdata) /* Convert to HEX and look if there is any matching file in the cache directory */ for (i = 0; i < 16; i++) { - snprintf(koko, sizeof(koko), "%X", MD5Res[i]); + snprintf(koko, sizeof(koko), "%X", (unsigned)MD5Res[i]); strncat(MD5Hex, koko, sizeof(MD5Hex) - strlen(MD5Hex) - 1); } readcache = 0; diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index 5cdeca1133..8192b76194 100644 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -87,7 +87,9 @@ static int cpeid_exec(struct ast_channel *chan, const char *idata) res = ast_adsi_get_cpeid(chan, cpeid, 0); if (res > 0) { gotcpeid = 1; - ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", cpeid[0], cpeid[1], cpeid[2], cpeid[3], ast_channel_name(chan)); + ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", + (unsigned)cpeid[0], (unsigned)cpeid[1], (unsigned)cpeid[2], + (unsigned)cpeid[3], ast_channel_name(chan)); } if (res > -1) { strcpy(data[1], "Measuring CPE..."); @@ -101,7 +103,9 @@ static int cpeid_exec(struct ast_channel *chan, const char *idata) } if (res > -1) { if (gotcpeid) - snprintf(data[1], 80, "CPEID: %02x:%02x:%02x:%02x", cpeid[0], cpeid[1], cpeid[2], cpeid[3]); + snprintf(data[1], 80, "CPEID: %02x:%02x:%02x:%02x", + (unsigned)cpeid[0], (unsigned)cpeid[1], + (unsigned)cpeid[2], (unsigned)cpeid[3]); else strcpy(data[1], "CPEID Unknown"); if (gotgeometry) diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 5f8a9cb435..231cc120e2 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1390,7 +1390,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu } } - fprintf(p, "Message-ID: \n", (unsigned int)ast_random(), vmu->username, (int)getpid(), who); + fprintf(p, "Message-ID: \n", (unsigned int)ast_random(), vmu->username, (int)getpid(), who); if (ast_strlen_zero(vmu->email)) { snprintf(email, sizeof(email), "%s@%s", vmu->username, vmu->domain); @@ -1441,7 +1441,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu fprintf(p, "MIME-Version: 1.0\n"); /* Something unique. */ - snprintf(bound, sizeof(bound), "voicemail_%s%d%d", vmu->username, (int)getpid(), (unsigned int)ast_random()); + snprintf(bound, sizeof(bound), "voicemail_%s%d%u", vmu->username, (int)getpid(), (unsigned int)ast_random()); fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound); diff --git a/apps/app_queue.c b/apps/app_queue.c index b8d275fcdb..bb4c0cc3ea 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -5711,7 +5711,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char * ast_monitor_start(which, qe->parent->monfmt, ast_channel_cdr(qe->chan)->uniqueid, 1, X_REC_IN | X_REC_OUT); } else { /* Last ditch effort -- no CDR, make up something */ - snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random()); + snprintf(tmpid, sizeof(tmpid), "chan-%lx", (unsigned long)ast_random()); ast_monitor_start(which, qe->parent->monfmt, tmpid, 1, X_REC_IN | X_REC_OUT); } if (!ast_strlen_zero(monexec)) { @@ -5726,7 +5726,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char * if (ast_channel_cdr(qe->chan)) { ast_copy_string(tmpid, ast_channel_cdr(qe->chan)->uniqueid, sizeof(tmpid)); } else { - snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random()); + snprintf(tmpid, sizeof(tmpid), "chan-%lx", (unsigned long)ast_random()); } } else { const char *m = monitorfilename; diff --git a/apps/app_sms.c b/apps/app_sms.c index 12fede073a..b7d2478188 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -782,7 +782,7 @@ static void sms_log(sms_t * h, char status) unsigned char n; if (h->mr >= 0) { - snprintf(mrs, sizeof(mrs), "%02X", h->mr); + snprintf(mrs, sizeof(mrs), "%02X", (unsigned)h->mr); } snprintf(line, sizeof(line), "%s %c%c%c%s %s %s %s ", isodate(time(NULL), buf, sizeof(buf)), @@ -999,7 +999,7 @@ static void sms_writefile(sms_t * h) snprintf(fn, sizeof(fn), "%s/sms/%s", ast_config_AST_SPOOL_DIR, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx"); ast_mkdir(fn, 0777); /* ensure it exists */ ast_copy_string(fn2, fn, sizeof(fn2)); - snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts.tv_sec, buf, sizeof(buf)), seq++); + snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%u", h->queue, isodate(h->scts.tv_sec, buf, sizeof(buf)), seq++); snprintf(fn + strlen(fn), sizeof(fn) - strlen(fn), "/.%s", fn2 + strlen(fn) + 1); if ((o = fopen(fn, "w")) == NULL) { return; @@ -1015,7 +1015,7 @@ static void sms_writefile(sms_t * h) unsigned int p; fprintf(o, "udh#"); for (p = 0; p < h->udhl; p++) { - fprintf(o, "%02X", h->udh[p]); + fprintf(o, "%02X", (unsigned)h->udh[p]); } fprintf(o, "\n"); } @@ -1048,13 +1048,13 @@ static void sms_writefile(sms_t * h) if (p == h->udl) { /* can write in ucs-1 hex */ fprintf(o, "ud#"); for (p = 0; p < h->udl; p++) { - fprintf(o, "%02X", h->ud[p]); + fprintf(o, "%02X", (unsigned)h->ud[p]); } fprintf(o, "\n"); } else { /* write in UCS-2 */ fprintf(o, "ud##"); for (p = 0; p < h->udl; p++) { - fprintf(o, "%04X", h->ud[p]); + fprintf(o, "%04X", (unsigned)h->ud[p]); } fprintf(o, "\n"); } @@ -1071,7 +1071,7 @@ static void sms_writefile(sms_t * h) fprintf(o, "dcs=%d\n", h->dcs); } if (h->vp) { - fprintf(o, "vp=%d\n", h->vp); + fprintf(o, "vp=%u\n", h->vp); } if (h->srr) { fprintf(o, "srr=1\n"); @@ -1139,7 +1139,7 @@ static unsigned char sms_handleincoming (sms_t * h) return 0xFF; /* duh! */ } } else { - ast_log(LOG_WARNING, "Unknown message type %02X\n", h->imsg[2]); + ast_log(LOG_WARNING, "Unknown message type %02X\n", (unsigned)h->imsg[2]); return 0xFF; } } else { /* client */ @@ -1162,7 +1162,7 @@ static unsigned char sms_handleincoming (sms_t * h) return 0xFF; /* duh! */ } } else { - ast_log(LOG_WARNING, "Unknown message type %02X\n", h->imsg[2]); + ast_log(LOG_WARNING, "Unknown message type %02X\n", (unsigned)h->imsg[2]); return 0xFF; } } @@ -1244,7 +1244,7 @@ static char *sms_hexdump(unsigned char buf[], int size, char *s /* destination * int f; for (p = s, f = 0; f < size && f < MAX_DEBUG_LEN; f++, p += 3) { - sprintf(p, "%02X ", (unsigned char)buf[f]); + sprintf(p, "%02X ", (unsigned)buf[f]); } return(s); } @@ -1270,7 +1270,7 @@ static int sms_handleincoming_proto2(sms_t *h) msgsz += (h->imsg[f++] * 256); switch (msg) { case 0x13: /* Body */ - ast_verb(3, "SMS-P2 Body#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]); + ast_verb(3, "SMS-P2 Body#%02X=[%.*s]\n", (unsigned)msg, msgsz, &h->imsg[f]); if (msgsz >= sizeof(h->ud)) { msgsz = sizeof(h->ud) - 1; } @@ -1288,27 +1288,27 @@ static int sms_handleincoming_proto2(sms_t *h) tm.tm_min = ( (h->imsg[f + 6] * 10) + h->imsg[f + 7] ); tm.tm_sec = 0; h->scts = ast_mktime(&tm, NULL); - ast_verb(3, "SMS-P2 Date#%02X=%02d/%02d %02d:%02d\n", msg, tm.tm_mday, tm.tm_mon + 1, tm.tm_hour, tm.tm_min); + ast_verb(3, "SMS-P2 Date#%02X=%02d/%02d %02d:%02d\n", (unsigned)msg, tm.tm_mday, tm.tm_mon + 1, tm.tm_hour, tm.tm_min); break; case 0x15: /* Calling line (from SMSC) */ if (msgsz >= 20) { msgsz = 20 - 1; } - ast_verb(3, "SMS-P2 Origin#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]); + ast_verb(3, "SMS-P2 Origin#%02X=[%.*s]\n", (unsigned)msg, msgsz, &h->imsg[f]); ast_copy_string(h->oa, (char *)(&h->imsg[f]), msgsz + 1); break; case 0x18: /* Destination(from TE/phone) */ if (msgsz >= 20) { msgsz = 20 - 1; } - ast_verb(3, "SMS-P2 Destination#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]); + ast_verb(3, "SMS-P2 Destination#%02X=[%.*s]\n", (unsigned)msg, msgsz, &h->imsg[f]); ast_copy_string(h->da, (char *)(&h->imsg[f]), msgsz + 1); break; case 0x1C: /* Notify */ - ast_verb(3, "SMS-P2 Notify#%02X=%s\n", msg, sms_hexdump(&h->imsg[f], 3, debug_buf)); + ast_verb(3, "SMS-P2 Notify#%02X=%s\n", (unsigned)msg, sms_hexdump(&h->imsg[f], 3, debug_buf)); break; default: - ast_verb(3, "SMS-P2 Par#%02X [%d]: %s\n", msg, msgsz, sms_hexdump(&h->imsg[f], msgsz, debug_buf)); + ast_verb(3, "SMS-P2 Par#%02X [%d]: %s\n", (unsigned)msg, msgsz, sms_hexdump(&h->imsg[f], msgsz, debug_buf)); break; } f+=msgsz; /* Skip to next */ @@ -1482,7 +1482,7 @@ static void sms_debug (int dir, sms_t *h) int n = (dir == DIR_RX) ? h->ibytep : msg[1] + 2; int q = 0; while (q < n && q < 30) { - sprintf(p, " %02X", msg[q++]); + sprintf(p, " %02X", (unsigned)msg[q++]); p += 3; } if (q < n) { @@ -1892,7 +1892,7 @@ static int sms_exec(struct ast_channel *chan, const char *data) ast_app_parse_options(sms_options, &flags, sms_opts, sms_args.options); } - ast_verb(1, "sms argc %d queue <%s> opts <%s> addr <%s> body <%s>\n", + ast_verb(1, "sms argc %u queue <%s> opts <%s> addr <%s> body <%s>\n", sms_args.argc, S_OR(sms_args.queue, ""), S_OR(sms_args.options, ""), S_OR(sms_args.addr, ""), diff --git a/apps/app_stack.c b/apps/app_stack.c index b069623289..dd195559e8 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -620,7 +620,7 @@ static int gosub_exec(struct ast_channel *chan, const char *data) frame_set_var(chan, newframe, argname, i < args2.argc ? args2.argval[i] : ""); ast_debug(1, "Setting '%s' to '%s'\n", argname, i < args2.argc ? args2.argval[i] : ""); } - snprintf(argname, sizeof(argname), "%d", args2.argc); + snprintf(argname, sizeof(argname), "%u", args2.argc); frame_set_var(chan, newframe, "ARGC", argname); /* And finally, save our return address */ diff --git a/apps/app_verbose.c b/apps/app_verbose.c index 8d285b02f7..c6fc8d17b9 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -78,7 +78,7 @@ static char *app_log = "Log"; static int verbose_exec(struct ast_channel *chan, const char *data) { - int vsize; + unsigned int vsize; char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(level); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 79173f07b3..89c42eef81 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4990,7 +4990,7 @@ static void make_email_file(FILE *p, } } - fprintf(p, "Message-ID: " ENDL, msgnum + 1, + fprintf(p, "Message-ID: " ENDL, msgnum + 1, (unsigned int) ast_random(), mailbox, (int) getpid(), host); if (imap) { /* additional information needed for IMAP searching */ @@ -5029,7 +5029,7 @@ static void make_email_file(FILE *p, fprintf(p, "MIME-Version: 1.0" ENDL); if (attach_user_voicemail) { /* Something unique. */ - snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%d", msgnum + 1, mailbox, + snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%u", msgnum + 1, mailbox, (int) getpid(), (unsigned int) ast_random()); fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"" ENDL, bound); @@ -5220,7 +5220,7 @@ static int sendmail(char *srcemail, if (!strcmp(format, "wav49")) format = "WAV"; - ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); + ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %u\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); /* Make a temporary file instead of piping directly to sendmail, in case the mail command hangs */ if ((p = vm_mkftemp(tmp)) == NULL) { @@ -5942,7 +5942,7 @@ static void generate_msg_id(char *dst) * called each time a new msg_id is generated. This should achieve uniqueness, * but only in single system solutions. */ - int unique_counter = ast_atomic_fetchadd_int(&msg_id_incrementor, +1); + unsigned int unique_counter = ast_atomic_fetchadd_int(&msg_id_incrementor, +1); snprintf(dst, MSG_ID_LEN, "%ld-%08x", (long) time(NULL), unique_counter); } @@ -12904,7 +12904,7 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con const char *val; char *q, *stringp, *tmp; int x; - int tmpadsi[4]; + unsigned int tmpadsi[4]; char secretfn[PATH_MAX] = ""; #ifdef IMAP_STORAGE diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c index e6626167fc..1b1437b96a 100644 --- a/apps/confbridge/conf_config_parser.c +++ b/apps/confbridge/conf_config_parser.c @@ -476,7 +476,7 @@ static int add_action_to_menu_entry(struct conf_menu_entry *menu_entry, enum con } menu_action->data.dialplan_args.priority = 1; /* 1 by default */ if (!ast_strlen_zero(args.priority) && - (sscanf(args.priority, "%30u", &menu_action->data.dialplan_args.priority) != 1)) { + (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) { /* invalid priority */ ast_free(menu_action); return -1; @@ -743,9 +743,9 @@ static char *handle_cli_confbridge_show_user_profile(struct ast_cli_entry *e, in ast_cli(a->fd,"Drop_silence: %s\n", u_profile.flags & USER_OPT_DROP_SILENCE ? "enabled" : "disabled"); - ast_cli(a->fd,"Silence Threshold: %dms\n", + ast_cli(a->fd,"Silence Threshold: %ums\n", u_profile.silence_threshold); - ast_cli(a->fd,"Talking Threshold: %dms\n", + ast_cli(a->fd,"Talking Threshold: %ums\n", u_profile.talking_threshold); ast_cli(a->fd,"Denoise: %s\n", u_profile.flags & USER_OPT_DENOISE ? @@ -868,14 +868,14 @@ static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e, ast_cli(a->fd,"Language: %s\n", b_profile.language); if (b_profile.internal_sample_rate) { - snprintf(tmp, sizeof(tmp), "%d", b_profile.internal_sample_rate); + snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate); } else { ast_copy_string(tmp, "auto", sizeof(tmp)); } ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp); if (b_profile.mix_interval) { - ast_cli(a->fd,"Mixing Interval: %d\n", b_profile.mix_interval); + ast_cli(a->fd,"Mixing Interval: %u\n", b_profile.mix_interval); } else { ast_cli(a->fd,"Mixing Interval: Default 20ms\n"); } @@ -889,7 +889,7 @@ static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e, b_profile.rec_file); if (b_profile.max_members) { - ast_cli(a->fd,"Max Members: %d\n", b_profile.max_members); + ast_cli(a->fd,"Max Members: %u\n", b_profile.max_members); } else { ast_cli(a->fd,"Max Members: No Limit\n"); } diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c index bf9f014f54..6c0ed058a1 100644 --- a/bridges/bridge_softmix.c +++ b/bridges/bridge_softmix.c @@ -663,7 +663,7 @@ static unsigned int analyse_softmix_stats(struct softmix_stats *stats, struct so * from the current rate we are using. */ if (softmix_data->internal_rate != stats->locked_rate) { softmix_data->internal_rate = stats->locked_rate; - ast_debug(1, " Bridge is locked in at sample rate %d\n", softmix_data->internal_rate); + ast_debug(1, " Bridge is locked in at sample rate %u\n", softmix_data->internal_rate); return 1; } } else if (stats->num_above_internal_rate >= 2) { @@ -702,13 +702,13 @@ static unsigned int analyse_softmix_stats(struct softmix_stats *stats, struct so } } - ast_debug(1, " Bridge changed from %d To %d\n", softmix_data->internal_rate, best_rate); + ast_debug(1, " Bridge changed from %u To %u\n", softmix_data->internal_rate, best_rate); softmix_data->internal_rate = best_rate; return 1; } else if (!stats->num_at_internal_rate && !stats->num_above_internal_rate) { /* In this case, the highest supported rate is actually lower than the internal rate */ softmix_data->internal_rate = stats->highest_supported_rate; - ast_debug(1, " Bridge changed from %d to %d\n", softmix_data->internal_rate, stats->highest_supported_rate); + ast_debug(1, " Bridge changed from %u to %u\n", softmix_data->internal_rate, stats->highest_supported_rate); return 1; } return 0; diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index 67dde10ff1..36a6c7c1ec 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -611,7 +611,7 @@ static int odbc_log(struct ast_cdr *cdr) if (ast_strlen_zero(colptr)) { continue; } else { - char integer = 0; + signed char integer = 0; if (sscanf(colptr, "%30hhd", &integer) != 1) { ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name); continue; @@ -626,7 +626,7 @@ static int odbc_log(struct ast_cdr *cdr) if (ast_strlen_zero(colptr)) { continue; } else { - char integer = 0; + signed char integer = 0; if (sscanf(colptr, "%30hhd", &integer) != 1) { ast_log(LOG_WARNING, "CDR variable %s is not an integer.\n", entry->name); continue; diff --git a/cel/cel_odbc.c b/cel/cel_odbc.c index 4145f1fca1..34c48f2835 100644 --- a/cel/cel_odbc.c +++ b/cel/cel_odbc.c @@ -473,11 +473,11 @@ static void odbc_log(const struct ast_event *event, void *userdata) } else if (strcmp(entry->celname, "peer") == 0) { ast_copy_string(colbuf, record.peer, sizeof(colbuf)); } else if (strcmp(entry->celname, "amaflags") == 0) { - snprintf(colbuf, sizeof(colbuf), "%d", record.amaflag); + snprintf(colbuf, sizeof(colbuf), "%u", record.amaflag); } else if (strcmp(entry->celname, "extra") == 0) { ast_copy_string(colbuf, record.extra, sizeof(colbuf)); } else if (strcmp(entry->celname, "eventtype") == 0) { - snprintf(colbuf, sizeof(colbuf), "%d", record.event_type); + snprintf(colbuf, sizeof(colbuf), "%u", record.event_type); } else { colbuf[0] = 0; unknown = 1; @@ -691,7 +691,7 @@ static void odbc_log(const struct ast_event *event, void *userdata) break; case SQL_TINYINT: { - char integer = 0; + signed char integer = 0; if (sscanf(colptr, "%30hhd", &integer) != 1) { ast_log(LOG_WARNING, "CEL variable %s is not an integer.\n", entry->name); continue; @@ -704,7 +704,7 @@ static void odbc_log(const struct ast_event *event, void *userdata) break; case SQL_BIT: { - char integer = 0; + signed char integer = 0; if (sscanf(colptr, "%30hhd", &integer) != 1) { ast_log(LOG_WARNING, "CEL variable %s is not an integer.\n", entry->name); continue; diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c index 536838b16d..541e016218 100644 --- a/cel/cel_pgsql.c +++ b/cel/cel_pgsql.c @@ -203,11 +203,11 @@ static void pgsql_log(const struct ast_event *event, void *userdata) if (strncmp(cur->type, "int", 3) == 0) { /* Integer, no need to escape anything */ LENGTHEN_BUF2(13); - ast_str_append(&sql2, 0, "%s%d", SEP, record.amaflag); + ast_str_append(&sql2, 0, "%s%u", SEP, record.amaflag); } else { /* Although this is a char field, there are no special characters in the values for these fields */ LENGTHEN_BUF2(31); - ast_str_append(&sql2, 0, "%s'%d'", SEP, record.amaflag); + ast_str_append(&sql2, 0, "%s'%u'", SEP, record.amaflag); } } else { /* Arbitrary field, could be anything */ diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 41c8a3a39e..f6bffccb78 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -201,12 +201,12 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream) direction = 0; err = snd_pcm_hw_params_set_rate_near(handle, hwparams, &rate, &direction); if (rate != DESIRED_RATE) - ast_log(LOG_WARNING, "Rate not correct, requested %d, got %d\n", DESIRED_RATE, rate); + ast_log(LOG_WARNING, "Rate not correct, requested %d, got %u\n", DESIRED_RATE, rate); direction = 0; err = snd_pcm_hw_params_set_period_size_near(handle, hwparams, &period_size, &direction); if (err < 0) - ast_log(LOG_ERROR, "period_size(%ld frames) is bad: %s\n", period_size, snd_strerror(err)); + ast_log(LOG_ERROR, "period_size(%lu frames) is bad: %s\n", period_size, snd_strerror(err)); else { ast_debug(1, "Period size is %d\n", err); } @@ -214,7 +214,7 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream) buffer_size = 4096 * 2; /* period_size * 16; */ err = snd_pcm_hw_params_set_buffer_size_near(handle, hwparams, &buffer_size); if (err < 0) - ast_log(LOG_WARNING, "Problem setting buffer size of %ld: %s\n", buffer_size, snd_strerror(err)); + ast_log(LOG_WARNING, "Problem setting buffer size of %lu: %s\n", buffer_size, snd_strerror(err)); else { ast_debug(1, "Buffer size is set to %d frames\n", err); } diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 5176aea01a..a07501598a 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2124,7 +2124,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n", f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End", - f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); + (unsigned)f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); if (f->subclass.integer == 'f') { if (f->frametype == AST_FRAME_DTMF_END) { @@ -3105,7 +3105,7 @@ static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoper } if (sub != ANALOG_SUB_REAL) { - ast_log(LOG_ERROR, "Trying to dial_digits '%s' on channel %d subchannel %d\n", + ast_log(LOG_ERROR, "Trying to dial_digits '%s' on channel %d subchannel %u\n", dop->dialstr, p->channel, sub); return -1; } @@ -7720,7 +7720,7 @@ static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_ch case AST_FRAME_NULL: break; default: - ast_debug(1, "Chan '%s' is discarding frame of frametype:%d\n", + ast_debug(1, "Chan '%s' is discarding frame of frametype:%u\n", ast_channel_name(who), f->frametype); break; } @@ -7932,7 +7932,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n", f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End", - f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); + (unsigned)f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); if (p->confirmanswer) { if (f->frametype == AST_FRAME_DTMF_END) { @@ -8357,7 +8357,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) return NULL; } mssinceflash = ast_tvdiff_ms(ast_tvnow(), p->flashtime); - ast_debug(1, "Last flash was %d ms ago\n", mssinceflash); + ast_debug(1, "Last flash was %u ms ago\n", mssinceflash); if (mssinceflash < MIN_MS_SINCE_FLASH) { /* It hasn't been long enough since the last flashook. This is probably a bounce on hanging up. Hangup both channels now */ @@ -8529,7 +8529,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_DIALTONE); break; default: - ast_log(LOG_WARNING, "FXO phone off hook in weird state %d??\n", ast_channel_state(ast)); + ast_log(LOG_WARNING, "FXO phone off hook in weird state %u??\n", ast_channel_state(ast)); } break; case SIG_FXSLS: @@ -8579,7 +8579,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) ast_setstate(ast, AST_STATE_UP); } } else if (ast_channel_state(ast) != AST_STATE_RING) - ast_log(LOG_WARNING, "Ring/Off-hook in strange state %d on channel %d\n", ast_channel_state(ast), p->channel); + ast_log(LOG_WARNING, "Ring/Off-hook in strange state %u on channel %d\n", ast_channel_state(ast), p->channel); break; default: ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig); @@ -8831,7 +8831,7 @@ winkflashdone: if (p->dialing) ast_debug(1, "Ignoring wink on channel %d\n", p->channel); else - ast_debug(1, "Got wink in weird state %d on channel %d\n", ast_channel_state(ast), p->channel); + ast_debug(1, "Got wink in weird state %u on channel %d\n", ast_channel_state(ast), p->channel); break; case SIG_FEATDMF_TA: switch (p->whichwink) { @@ -8936,7 +8936,7 @@ winkflashdone: p->polaritydelaytv = ast_tvnow(); } } else - ast_debug(1, "Ignore switch to REVERSED Polarity on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Ignore switch to REVERSED Polarity on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } /* Removed else statement from here as it was preventing hangups from ever happening*/ /* Added AST_STATE_RING in if statement below to deal with calling party hangups that take place when ringing */ @@ -8945,21 +8945,21 @@ winkflashdone: (p->polarity == POLARITY_REV) && ((ast_channel_state(ast) == AST_STATE_UP) || (ast_channel_state(ast) == AST_STATE_RING)) ) { /* Added log_debug information below to provide a better indication of what is going on */ - ast_debug(1, "Polarity Reversal event occured - DEBUG 1: channel %d, state %d, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); + ast_debug(1, "Polarity Reversal event occured - DEBUG 1: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); if (ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) > p->polarityonanswerdelay) { ast_debug(1, "Polarity Reversal detected and now Hanging up on channel %d\n", p->channel); ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT); p->polarity = POLARITY_IDLE; } else - ast_debug(1, "Polarity Reversal detected but NOT hanging up (too close to answer event) on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Polarity Reversal detected but NOT hanging up (too close to answer event) on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } else { p->polarity = POLARITY_IDLE; - ast_debug(1, "Ignoring Polarity switch to IDLE on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Ignoring Polarity switch to IDLE on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } /* Added more log_debug information below to provide a better indication of what is going on */ - ast_debug(1, "Polarity Reversal event occured - DEBUG 2: channel %d, state %d, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); + ast_debug(1, "Polarity Reversal event occured - DEBUG 2: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); break; default: ast_debug(1, "Dunno what to do with event %d on channel %d\n", res, p->channel); @@ -9479,7 +9479,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) /* Don't accept in-band DTMF when in overlap dial mode */ ast_debug(1, "Absorbing inband %s DTMF digit: 0x%02X '%c' on %s\n", f->frametype == AST_FRAME_DTMF_BEGIN ? "begin" : "end", - f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); + (unsigned)f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); f->frametype = AST_FRAME_NULL; f->subclass.integer = 0; @@ -9591,7 +9591,7 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame) /* Write a frame of (presumably voice) data */ if (frame->frametype != AST_FRAME_VOICE) { if (frame->frametype != AST_FRAME_IMAGE) - ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype); + ast_log(LOG_WARNING, "Don't know what to do with frame type '%u'\n", frame->frametype); return 0; } if ((frame->subclass.format.id != AST_FORMAT_SLINEAR) && @@ -9783,15 +9783,15 @@ static struct ast_str *create_channel_name(struct dahdi_pvt *i) ast_mutex_lock(&i->pri->lock); y = ++i->pri->new_chan_seq; if (is_outgoing) { - ast_str_set(&chan_name, 0, "i%d/%s-%x", i->pri->span, address, y); + ast_str_set(&chan_name, 0, "i%d/%s-%x", i->pri->span, address, (unsigned)y); address[0] = '\0'; } else if (ast_strlen_zero(i->cid_subaddr)) { /* Put in caller-id number only since there is no subaddress. */ - ast_str_set(&chan_name, 0, "i%d/%s-%x", i->pri->span, i->cid_num, y); + ast_str_set(&chan_name, 0, "i%d/%s-%x", i->pri->span, i->cid_num, (unsigned)y); } else { /* Put in caller-id number and subaddress. */ ast_str_set(&chan_name, 0, "i%d/%s:%s-%x", i->pri->span, i->cid_num, - i->cid_subaddr, y); + i->cid_subaddr, (unsigned)y); } ast_mutex_unlock(&i->pri->lock); #endif /* defined(HAVE_PRI) */ @@ -15809,9 +15809,9 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli ast_cli(a->fd, "Echo Cancellation:\n"); if (tmp->echocancel.head.tap_length) { - ast_cli(a->fd, "\t%d taps\n", tmp->echocancel.head.tap_length); + ast_cli(a->fd, "\t%u taps\n", tmp->echocancel.head.tap_length); for (x = 0; x < tmp->echocancel.head.param_count; x++) { - ast_cli(a->fd, "\t\t%s: %ud\n", tmp->echocancel.params[x].name, tmp->echocancel.params[x].value); + ast_cli(a->fd, "\t\t%s: %dd\n", tmp->echocancel.params[x].name, tmp->echocancel.params[x].value); } ast_cli(a->fd, "\t%scurrently %s\n", tmp->echocanbridged ? "" : "(unless TDM bridged) ", tmp->echocanon ? "ON" : "OFF"); } else { @@ -15872,7 +15872,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli ast_cli(a->fd, "PRI Flags: "); if (chan->resetting != SIG_PRI_RESET_IDLE) { - ast_cli(a->fd, "Resetting=%d ", chan->resetting); + ast_cli(a->fd, "Resetting=%u ", chan->resetting); } if (chan->call) ast_cli(a->fd, "Call "); @@ -15891,7 +15891,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli if (tmp->subs[SUB_REAL].dfd > -1) { memset(&ci, 0, sizeof(ci)); if (!ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GETCONF, &ci)) { - ast_cli(a->fd, "Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, ci.confmode); + ast_cli(a->fd, "Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, (unsigned)ci.confmode); } if (!ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GETCONFMUTE, &x)) { ast_cli(a->fd, "Actual Confmute: %s\n", x ? "Yes" : "No"); @@ -17412,12 +17412,12 @@ static void process_echocancel(struct dahdi_chan_conf *confp, const char *data, } param; if (ast_app_separate_args(params[x], '=', (char **) ¶m, 2) < 1) { - ast_log(LOG_WARNING, "Invalid echocancel parameter supplied at line %d: '%s'\n", line, params[x]); + ast_log(LOG_WARNING, "Invalid echocancel parameter supplied at line %u: '%s'\n", line, params[x]); continue; } if (ast_strlen_zero(param.name) || (strlen(param.name) > sizeof(confp->chan.echocancel.params[0].name)-1)) { - ast_log(LOG_WARNING, "Invalid echocancel parameter supplied at line %d: '%s'\n", line, param.name); + ast_log(LOG_WARNING, "Invalid echocancel parameter supplied at line %u: '%s'\n", line, param.name); continue; } @@ -17425,7 +17425,7 @@ static void process_echocancel(struct dahdi_chan_conf *confp, const char *data, if (param.value) { if (sscanf(param.value, "%30d", &confp->chan.echocancel.params[confp->chan.echocancel.head.param_count].value) != 1) { - ast_log(LOG_WARNING, "Invalid echocancel parameter value supplied at line %d: '%s'\n", line, param.value); + ast_log(LOG_WARNING, "Invalid echocancel parameter value supplied at line %u: '%s'\n", line, param.value); continue; } } diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index f30a3413b2..83dca94d23 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -916,8 +916,8 @@ static int gtalk_create_candidates(struct gtalk *client, struct gtalk_pvt *p, ch ast_copy_string(ours1->name, "rtp", sizeof(ours1->name)); ours1->port = ntohs(sin.sin_port); ours1->preference = 1; - snprintf(user, sizeof(user), "%08lx%08lx", ast_random(), ast_random()); - snprintf(pass, sizeof(pass), "%08lx%08lx", ast_random(), ast_random()); + snprintf(user, sizeof(user), "%08lx%08lx", (long unsigned)ast_random(), (long unsigned)ast_random()); + snprintf(pass, sizeof(pass), "%08lx%08lx", (long unsigned)ast_random(), (long unsigned)ast_random()); ast_copy_string(ours1->username, user, sizeof(ours1->username)); ast_copy_string(ours1->password, pass, sizeof(ours1->password)); ast_copy_string(ours1->ip, ast_sockaddr_stringify_addr(&us), @@ -1062,7 +1062,7 @@ static struct gtalk_pvt *gtalk_alloc(struct gtalk *client, const char *us, const ast_copy_string(tmp->them, them, sizeof(tmp->them)); ast_copy_string(tmp->us, us, sizeof(tmp->us)); } else { - snprintf(tmp->sid, sizeof(tmp->sid), "%08lx%08lx", ast_random(), ast_random()); + snprintf(tmp->sid, sizeof(tmp->sid), "%08lx%08lx", (long unsigned)ast_random(), (long unsigned)ast_random()); ast_copy_string(tmp->them, idroster, sizeof(tmp->them)); ast_copy_string(tmp->us, us, sizeof(tmp->us)); tmp->initiator = 1; @@ -1125,7 +1125,9 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, n2 = title; else n2 = i->us; - tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, linkedid, client->accountcode, i->exten, client->context, client->amaflags, "Gtalk/%s-%04lx", n2, ast_random() & 0xffff); + tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, linkedid, + client->accountcode, i->exten, client->context, client->amaflags, + "Gtalk/%s-%04lx", n2, (long unsigned)(ast_random() & 0xffff)); if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate Gtalk channel structure!\n"); return NULL; @@ -1692,7 +1694,7 @@ static int gtalk_write(struct ast_channel *ast, struct ast_frame *frame) return 0; break; default: - ast_log(LOG_WARNING, "Can't send %d type frames with Gtalk write\n", + ast_log(LOG_WARNING, "Can't send %u type frames with Gtalk write\n", frame->frametype); return 0; } diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index a288644785..f4369213ef 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -357,7 +357,7 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL; break; \ \ for (idx = 0; idx < 16; idx++) \ - sprintf(digest + (idx << 1), "%2.2x", (unsigned char) key[idx]); \ + sprintf(digest + (idx << 1), "%2.2x", (unsigned) key[idx]); \ \ ast_log(LOG_NOTICE, msg " IAX_COMMAND_RTKEY to rotate key to '%s'\n", digest); \ } while(0) @@ -2414,7 +2414,7 @@ static int calltoken_required(struct sockaddr_in *sin, const char *name, int sub user_unref(user); } - ast_debug(1, "Determining if address %s with username %s requires calltoken validation. Optional = %d calltoken_required = %d \n", ast_inet_ntoa(sin->sin_addr), name, optional, calltoken_required); + ast_debug(1, "Determining if address %s with username %s requires calltoken validation. Optional = %d calltoken_required = %u\n", ast_inet_ntoa(sin->sin_addr), name, optional, calltoken_required); if (((calltoken_required == CALLTOKEN_NO) || (calltoken_required == CALLTOKEN_AUTO)) || (optional && (calltoken_required == CALLTOKEN_DEFAULT))) { res = 0; @@ -3177,7 +3177,7 @@ static int try_firmware(char *s) else last = s; - snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random()); + snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, ast_random()); if (stat(s, &stbuf) < 0) { ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno)); @@ -3478,7 +3478,7 @@ static int send_packet(struct iax_frame *f) /* Called with iaxsl held */ if (iaxdebug) - ast_debug(3, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); + ast_debug(3, "Sending %u on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port)); if (f->transfer) { iax_outputframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr)); @@ -3637,7 +3637,7 @@ static void __attempt_transmit(const void *data) iax2_destroy(callno); } else { if (iaxs[callno]->owner) { - ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %u, ts=%d, seqno=%d)\n", + ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %u, subclass = %d, ts=%u, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr), ast_channel_name(iaxs[f->callno]->owner), f->af.frametype, @@ -5554,7 +5554,7 @@ static int iax2_key_rotate(const void *vpvt) ast_mutex_lock(&iaxsl[pvt->callno]); pvt->keyrotateid = ast_sched_add(sched, 120000 + (ast_random() % 180001), iax2_key_rotate, vpvt); - snprintf(key, sizeof(key), "%lX", ast_random()); + snprintf(key, sizeof(key), "%lX", (unsigned long)ast_random()); MD5Init(&md5); MD5Update(&md5, (unsigned char *) key, strlen(key)); @@ -5841,7 +5841,7 @@ static int iax2_indicate(struct ast_channel *c, int condition, const void *data, case AST_CONTROL_REDIRECTING: if (!ast_test_flag64(pvt, IAX_SENDCONNECTEDLINE)) { /* We are not configured to allow sending these updates. */ - ast_debug(2, "Callno %u: Config blocked sending control frame %d.\n", + ast_debug(2, "Callno %d: Config blocked sending control frame %d.\n", callno, condition); goto done; } @@ -6179,7 +6179,7 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str * frame size too) */ if (iaxdebug && abs(ms - p->nextpred) > MAX_TIMESTAMP_SKEW ) - ast_debug(1, "predicted timestamp skew (%u) > max (%u), using real ts instead.\n", + ast_debug(1, "predicted timestamp skew (%d) > max (%d), using real ts instead.\n", abs(ms - p->nextpred), MAX_TIMESTAMP_SKEW); if (f->samples >= rate) /* check to make sure we don't core dump */ @@ -6234,7 +6234,7 @@ static unsigned int calc_rxstamp(struct chan_iax2_pvt *p, unsigned int offset) if (ast_tvzero(p->rxcore)) { p->rxcore = ast_tvnow(); if (iaxdebug) - ast_debug(1, "calc_rxstamp: call=%d: rxcore set to %d.%6.6d - %dms\n", + ast_debug(1, "calc_rxstamp: call=%d: rxcore set to %d.%6.6d - %ums\n", p->callno, (int)(p->rxcore.tv_sec), (int)(p->rxcore.tv_usec), offset); p->rxcore = ast_tvsub(p->rxcore, ast_samp2tv(offset, 1000)); #if 1 @@ -6319,7 +6319,7 @@ static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr) tpeer->trunkdataalloc += DEFAULT_TRUNKDATA; tpeer->trunkdata = tmp; - ast_debug(1, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc); + ast_debug(1, "Expanded trunk '%s:%d' to %u bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc); } else { ast_log(LOG_WARNING, "Maximum trunk data space exceeded to %s:%d\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port)); ast_mutex_unlock(&tpeer->lock); @@ -6459,7 +6459,7 @@ static int decode_frame(ast_aes_decrypt_key *dcx, struct ast_iax2_full_hdr *fh, padding = 16 + (workspace[15] & 0x0f); if (iaxdebug) - ast_debug(1, "Decoding full frame with length %d (padding = %d) (15=%02x)\n", *datalen, padding, workspace[15]); + ast_debug(1, "Decoding full frame with length %d (padding = %d) (15=%02x)\n", *datalen, padding, (unsigned)workspace[15]); if (*datalen < padding + sizeof(struct ast_iax2_full_hdr)) return -1; @@ -6506,7 +6506,7 @@ static int encrypt_frame(ast_aes_encrypt_key *ecx, struct ast_iax2_full_hdr *fh, workspace[15] &= 0xf0; workspace[15] |= (padding & 0xf); if (iaxdebug) - ast_debug(1, "Encoding full frame %d/%d with length %d + %d padding (15=%02x)\n", fh->type, fh->csub, *datalen, padding, workspace[15]); + ast_debug(1, "Encoding full frame %d/%d with length %d + %d padding (15=%02x)\n", fh->type, fh->csub, *datalen, padding, (unsigned)workspace[15]); *datalen += padding; memcpy_encrypt(efh->encdata, workspace, *datalen - sizeof(struct ast_iax2_full_enc_hdr), ecx); if (*datalen >= 32 + sizeof(struct ast_iax2_full_enc_hdr)) @@ -7007,10 +7007,10 @@ static char *handle_cli_iax2_show_threads(struct ast_cli_entry *e, int cmd, stru AST_LIST_LOCK(&idle_list); AST_LIST_TRAVERSE(&idle_list, thread, list) { #ifdef DEBUG_SCHED_MULTITHREAD - ast_cli(a->fd, "Thread %d: state=%d, update=%d, actions=%d, func='%s'\n", + ast_cli(a->fd, "Thread %d: state=%u, update=%d, actions=%d, func='%s'\n", thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions, thread->curfunc); #else - ast_cli(a->fd, "Thread %d: state=%d, update=%d, actions=%d\n", + ast_cli(a->fd, "Thread %d: state=%u, update=%d, actions=%d\n", thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions); #endif threadcount++; @@ -7024,10 +7024,10 @@ static char *handle_cli_iax2_show_threads(struct ast_cli_entry *e, int cmd, stru else type = 'P'; #ifdef DEBUG_SCHED_MULTITHREAD - ast_cli(a->fd, "Thread %c%d: state=%d, update=%d, actions=%d, func='%s'\n", + ast_cli(a->fd, "Thread %c%d: state=%u, update=%d, actions=%d, func='%s'\n", type, thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions, thread->curfunc); #else - ast_cli(a->fd, "Thread %c%d: state=%d, update=%d, actions=%d\n", + ast_cli(a->fd, "Thread %c%d: state=%u, update=%d, actions=%d\n", type, thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions); #endif threadcount++; @@ -7037,10 +7037,10 @@ static char *handle_cli_iax2_show_threads(struct ast_cli_entry *e, int cmd, stru AST_LIST_LOCK(&dynamic_list); AST_LIST_TRAVERSE(&dynamic_list, thread, list) { #ifdef DEBUG_SCHED_MULTITHREAD - ast_cli(a->fd, "Thread %d: state=%d, update=%d, actions=%d, func='%s'\n", + ast_cli(a->fd, "Thread %d: state=%u, update=%d, actions=%d, func='%s'\n", thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions, thread->curfunc); #else - ast_cli(a->fd, "Thread %d: state=%d, update=%d, actions=%d\n", + ast_cli(a->fd, "Thread %d: state=%u, update=%d, actions=%d\n", thread->threadnum, thread->iostate, (int)(t - thread->checktime), thread->actions); #endif dynamiccount++; @@ -7434,8 +7434,8 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt) int numchans = 0; char first_message[10] = { 0, }; char last_message[10] = { 0, }; -#define ACN_FORMAT1 "%-20.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d %s%s %4s%s\n" -#define ACN_FORMAT2 "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %s%s %s%s\n" +#define ACN_FORMAT1 "%-20.25s %4u %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d %s%s %4s%s\n" +#define ACN_FORMAT2 "%s %u %d %d %d %d %d %d %d %d %d %d %d %d %d %d %s%s %s%s\n" for (x = 0; x < ARRAY_LEN(iaxs); x++) { ast_mutex_lock(&iaxsl[x]); if (iaxs[x]) { @@ -7692,7 +7692,7 @@ static int send_command(struct chan_iax2_pvt *i, char type, int command, unsigne { if (type == AST_FRAME_CONTROL && !iax2_is_control_frame_allowed(command)) { /* Control frame should not go out on the wire. */ - ast_debug(2, "Callno %u: Blocked sending control frame %d.\n", + ast_debug(2, "Callno %d: Blocked sending control frame %d.\n", i->callno, command); return 0; } @@ -8125,7 +8125,7 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies) MD5Final(digest, &md5); /* If they support md5, authenticate with it. */ for (x=0;x<16;x++) - sprintf(requeststr + (x << 1), "%2.2x", digest[x]); /* safe */ + sprintf(requeststr + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ if (!strcasecmp(requeststr, md5secret)) { res = 0; break; @@ -8255,7 +8255,7 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies * MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw)); MD5Final(digest, &md5); for (x=0;x<16;x++) - sprintf(requeststr + (x << 1), "%2.2x", digest[x]); /* safe */ + sprintf(requeststr + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ if (!strcasecmp(requeststr, md5secret)) break; } @@ -8338,7 +8338,7 @@ static int authenticate(const char *challenge, const char *secret, const char *k MD5Final(digest, &md5); /* If they support md5, authenticate with it. */ for (x=0;x<16;x++) - sprintf(digres + (x << 1), "%2.2x", digest[x]); /* safe */ + sprintf(digres + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ if (pvt) { build_encryption_keys(digest, pvt); } @@ -9392,7 +9392,7 @@ static int timing_read(int *id, int fd, short events, void *cbdata) res = send_trunk(tpeer, &now); trunk_timed++; if (iaxtrunkdebug) - ast_verbose(" - Trunk peer (%s:%d) has %d call chunk%s in transit, %d bytes backloged and has hit a high water mark of %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), res, (res != 1) ? "s" : "", tpeer->trunkdatalen, tpeer->trunkdataalloc); + ast_verbose(" - Trunk peer (%s:%d) has %d call chunk%s in transit, %u bytes backloged and has hit a high water mark of %u bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), res, (res != 1) ? "s" : "", tpeer->trunkdatalen, tpeer->trunkdataalloc); } totalcalls += res; res = 0; @@ -9701,7 +9701,7 @@ static void log_jitterstats(unsigned short callno) localooo = jbinfo.frames_ooo; localpackets = jbinfo.frames_in; } - ast_debug(3, "JB STATS:%s ping=%d ljitterms=%d ljbdelayms=%d ltotlost=%d lrecentlosspct=%d ldropped=%d looo=%d lrecvd=%d rjitterms=%d rjbdelayms=%d rtotlost=%d rrecentlosspct=%d rdropped=%d rooo=%d rrecvd=%d\n", + ast_debug(3, "JB STATS:%s ping=%u ljitterms=%d ljbdelayms=%d ltotlost=%d lrecentlosspct=%d ldropped=%d looo=%d lrecvd=%d rjitterms=%d rjbdelayms=%d rtotlost=%d rrecentlosspct=%d rdropped=%d rooo=%d rrecvd=%d\n", ast_channel_name(iaxs[callno]->owner), iaxs[callno]->pingtime, localjitter, @@ -9718,7 +9718,7 @@ static void log_jitterstats(unsigned short callno) iaxs[callno]->remote_rr.dropped, iaxs[callno]->remote_rr.ooo, iaxs[callno]->remote_rr.packets); - manager_event(EVENT_FLAG_REPORTING, "JitterBufStats", "Owner: %s\r\nPing: %d\r\nLocalJitter: %d\r\nLocalJBDelay: %d\r\nLocalTotalLost: %d\r\nLocalLossPercent: %d\r\nLocalDropped: %d\r\nLocalooo: %d\r\nLocalReceived: %d\r\nRemoteJitter: %d\r\nRemoteJBDelay: %d\r\nRemoteTotalLost: %d\r\nRemoteLossPercent: %d\r\nRemoteDropped: %d\r\nRemoteooo: %d\r\nRemoteReceived: %d\r\n", + manager_event(EVENT_FLAG_REPORTING, "JitterBufStats", "Owner: %s\r\nPing: %u\r\nLocalJitter: %d\r\nLocalJBDelay: %d\r\nLocalTotalLost: %d\r\nLocalLossPercent: %d\r\nLocalDropped: %d\r\nLocalooo: %d\r\nLocalReceived: %d\r\nRemoteJitter: %d\r\nRemoteJBDelay: %d\r\nRemoteTotalLost: %d\r\nRemoteLossPercent: %d\r\nRemoteDropped: %d\r\nRemoteooo: %d\r\nRemoteReceived: %d\r\n", ast_channel_name(iaxs[callno]->owner), iaxs[callno]->pingtime, localjitter, @@ -10408,7 +10408,7 @@ static int socket_process_helper(struct iax2_thread *thread) } if (ntohs(mh->callno) & IAX_FLAG_FULL) { if (iaxdebug) - ast_debug(1, "Received packet %d, (%d, %u)\n", fh->oseqno, f.frametype, f.subclass.integer); + ast_debug(1, "Received packet %d, (%u, %d)\n", fh->oseqno, f.frametype, f.subclass.integer); /* Check if it's out of order (and not an ACK or INVAL) */ fr->oseqno = fh->oseqno; fr->iseqno = fh->iseqno; @@ -10448,7 +10448,7 @@ static int socket_process_helper(struct iax2_thread *thread) (f.subclass.integer != IAX_COMMAND_VNAK)) || (f.frametype != AST_FRAME_IAX)) { /* If it's not an ACK packet, it's out of order. */ - ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", + ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %u, subclass = %d)\n", iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass.integer); /* Check to see if we need to request retransmission, * and take sequence number wraparound into account */ @@ -10688,7 +10688,7 @@ static int socket_process_helper(struct iax2_thread *thread) f.subclass.integer != IAX_COMMAND_LAGRP) { iaxs[fr->callno]->last = fr->ts; if (iaxdebug) - ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts); + ast_debug(1, "For call=%d, set last=%u\n", fr->callno, fr->ts); } iaxs[fr->callno]->last_iax_message = f.subclass.integer; if (!iaxs[fr->callno]->first_iax_message) { @@ -11189,14 +11189,14 @@ static int socket_process_helper(struct iax2_thread *thread) peer = iaxs[fr->callno]->peerpoke; if ((peer->lastms < 0) || (peer->historicms > peer->maxms)) { if (iaxs[fr->callno]->pingtime <= peer->maxms) { - ast_log(LOG_NOTICE, "Peer '%s' is now REACHABLE! Time: %d\n", peer->name, iaxs[fr->callno]->pingtime); - manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Reachable\r\nTime: %d\r\n", peer->name, iaxs[fr->callno]->pingtime); + ast_log(LOG_NOTICE, "Peer '%s' is now REACHABLE! Time: %u\n", peer->name, iaxs[fr->callno]->pingtime); + manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Reachable\r\nTime: %u\r\n", peer->name, iaxs[fr->callno]->pingtime); ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "IAX2/%s", peer->name); /* Activate notification */ } } else if ((peer->historicms > 0) && (peer->historicms <= peer->maxms)) { if (iaxs[fr->callno]->pingtime > peer->maxms) { - ast_log(LOG_NOTICE, "Peer '%s' is now TOO LAGGED (%d ms)!\n", peer->name, iaxs[fr->callno]->pingtime); - manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Lagged\r\nTime: %d\r\n", peer->name, iaxs[fr->callno]->pingtime); + ast_log(LOG_NOTICE, "Peer '%s' is now TOO LAGGED (%u ms)!\n", peer->name, iaxs[fr->callno]->pingtime); + manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Lagged\r\nTime: %u\r\n", peer->name, iaxs[fr->callno]->pingtime); ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "IAX2/%s", peer->name); /* Activate notification */ } } @@ -11891,7 +11891,7 @@ immediatedial: if (f.frametype == AST_FRAME_CONTROL) { if (!iax2_is_control_frame_allowed(f.subclass.integer)) { /* Control frame not allowed to come from the wire. */ - ast_debug(2, "Callno %u: Blocked receiving control frame %d.\n", + ast_debug(2, "Callno %d: Blocked receiving control frame %d.\n", fr->callno, f.subclass.integer); ast_variables_destroy(ies.vars); ast_mutex_unlock(&iaxsl[fr->callno]); @@ -11902,7 +11902,7 @@ immediatedial: if (iaxs[fr->callno] && !ast_test_flag64(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) { /* We are not configured to allow receiving these updates. */ - ast_debug(2, "Callno %u: Config blocked receiving control frame %d.\n", + ast_debug(2, "Callno %d: Config blocked receiving control frame %d.\n", fr->callno, f.subclass.integer); ast_variables_destroy(ies.vars); ast_mutex_unlock(&iaxsl[fr->callno]); @@ -11974,7 +11974,7 @@ immediatedial: fr->outoforder = 0; } else { if (iaxdebug && iaxs[fr->callno]) { - ast_debug(1, "Received out of order packet... (type=%d, subclass %d, ts = %d, last = %d)\n", f.frametype, f.subclass.integer, fr->ts, iaxs[fr->callno]->last); + ast_debug(1, "Received out of order packet... (type=%u, subclass %d, ts = %u, last = %u)\n", f.frametype, f.subclass.integer, fr->ts, iaxs[fr->callno]->last); } fr->outoforder = -1; } @@ -11989,7 +11989,7 @@ immediatedial: iaxs[fr->callno]->last = fr->ts; #if 1 if (iaxdebug) - ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts); + ast_debug(1, "For call=%d, set last=%u\n", fr->callno, fr->ts); #endif } @@ -14441,7 +14441,7 @@ static int iax2_devicestate(const char *data) return res; res = AST_DEVICE_UNAVAILABLE; - ast_debug(3, "Found peer. What's device state of %s? addr=%d, defaddr=%d maxms=%d, lastms=%d\n", + ast_debug(3, "Found peer. What's device state of %s? addr=%u, defaddr=%u maxms=%d, lastms=%d\n", pds.peer, ast_sockaddr_ipv4(&p->addr), p->defaddr.sin_addr.s_addr, p->maxms, p->lastms); if ((ast_sockaddr_ipv4(&p->addr) || p->defaddr.sin_addr.s_addr) && diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c index 661477ec7e..8a2ce473c3 100644 --- a/channels/chan_jingle.c +++ b/channels/chan_jingle.c @@ -648,10 +648,10 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p, ours1->port = ntohs(sin.sin_port); ours1->priority = 1678246398; ours1->protocol = AJI_PROTOCOL_UDP; - snprintf(pass, sizeof(pass), "%08lx%08lx", ast_random(), ast_random()); + snprintf(pass, sizeof(pass), "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); ast_copy_string(ours1->password, pass, sizeof(ours1->password)); ours1->type = AJI_CONNECT_HOST; - snprintf(user, sizeof(user), "%08lx%08lx", ast_random(), ast_random()); + snprintf(user, sizeof(user), "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); ast_copy_string(ours1->ufrag, user, sizeof(ours1->ufrag)); p->ourcandidates = ours1; @@ -668,11 +668,11 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p, ours2->port = ntohs(sin.sin_port); ours2->priority = 1678246397; ours2->protocol = AJI_PROTOCOL_UDP; - snprintf(pass, sizeof(pass), "%08lx%08lx", ast_random(), ast_random()); + snprintf(pass, sizeof(pass), "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); ast_copy_string(ours2->password, pass, sizeof(ours2->password)); ours2->type = AJI_CONNECT_PRFLX; - snprintf(user, sizeof(user), "%08lx%08lx", ast_random(), ast_random()); + snprintf(user, sizeof(user), "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); ast_copy_string(ours2->ufrag, user, sizeof(ours2->ufrag)); ours1->next = ours2; ours2 = NULL; @@ -805,7 +805,7 @@ static struct jingle_pvt *jingle_alloc(struct jingle *client, const char *from, ast_copy_string(tmp->sid, sid, sizeof(tmp->sid)); ast_copy_string(tmp->them, from, sizeof(tmp->them)); } else { - snprintf(tmp->sid, sizeof(tmp->sid), "%08lx%08lx", ast_random(), ast_random()); + snprintf(tmp->sid, sizeof(tmp->sid), "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); ast_copy_string(tmp->them, idroster, sizeof(tmp->them)); tmp->initiator = 1; } @@ -838,7 +838,7 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * str = title; else str = i->them; - tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", "", "", linkedid, 0, "Jingle/%s-%04lx", str, ast_random() & 0xffff); + tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", "", "", linkedid, 0, "Jingle/%s-%04lx", str, (unsigned long)(ast_random() & 0xffff)); if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate Jingle channel structure!\n"); return NULL; @@ -1297,7 +1297,7 @@ static int jingle_write(struct ast_channel *ast, struct ast_frame *frame) return 0; break; default: - ast_log(LOG_WARNING, "Can't send %d type frames with Jingle write\n", + ast_log(LOG_WARNING, "Can't send %u type frames with Jingle write\n", frame->frametype); return 0; } diff --git a/channels/chan_local.c b/channels/chan_local.c index 43516c8b84..251465012f 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -1243,8 +1243,8 @@ static struct ast_channel *local_new(struct local_pvt *p, int state, const char /* Make sure that the ;2 channel gets the same linkedid as ;1. You can't pass linkedid to both * allocations since if linkedid isn't set, then each channel will generate its own linkedid. */ - if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%08x;1", p->exten, p->context, generated_seqno)) - || !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ast_channel_linkedid(tmp), ama, "Local/%s@%s-%08x;2", p->exten, p->context, generated_seqno))) { + if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%08x;1", p->exten, p->context, (unsigned)generated_seqno)) + || !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ast_channel_linkedid(tmp), ama, "Local/%s@%s-%08x;2", p->exten, p->context, (unsigned)generated_seqno))) { if (tmp) { tmp = ast_channel_release(tmp); } diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index d8e94a7e24..9df76a3fb1 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1249,7 +1249,7 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame) if (frame->frametype == AST_FRAME_IMAGE) return 0; else { - ast_log(LOG_WARNING, "Can't send %d type frames with MGCP write\n", frame->frametype); + ast_log(LOG_WARNING, "Can't send %u type frames with MGCP write\n", frame->frametype); return 0; } } else { @@ -2022,7 +2022,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req) sdpLineNum_iterator_init(&iterator); while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') { char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */ - if (sscanf(a, "rtpmap: %30u %127[^/]/", &codec, mimeSubtype) != 2) + if (sscanf(a, "rtpmap: %30d %127[^/]/", &codec, mimeSubtype) != 2) continue; /* Note: should really look at the 'freq' and '#chans' params too */ ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(sub->rtp), sub->rtp, codec, "audio", mimeSubtype, 0); @@ -2122,9 +2122,9 @@ static int init_req(struct mgcp_endpoint *p, struct mgcp_request *req, char *ver req->header[req->headers] = req->data + req->len; /* check if we need brackets around the gw name */ if (p->parent->isnamedottedip) { - snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s %d %s@[%s] MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ? " NCS 1.0" : ""); + snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s %u %s@[%s] MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ? " NCS 1.0" : ""); } else { -+ snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s %d %s@%s MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ? " NCS 1.0" : ""); ++ snprintf(req->header[req->headers], sizeof(req->data) - req->len, "%s %u %s@%s MGCP 1.0%s\r\n", verb, oseq, p->name, p->parent->name, p->ncs ? " NCS 1.0" : ""); } req->len += strlen(req->header[req->headers]); if (req->headers < MGCP_MAX_HEADERS) { @@ -2793,7 +2793,7 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub req = find_command(p, sub, &p->cmd_queue, &p->cmd_queue_lock, ident); if (!req) { - ast_verb(3, "No command found on [%s] for transaction %d. Ignoring...\n", + ast_verb(3, "No command found on [%s] for transaction %u. Ignoring...\n", gw->name, ident); return; } @@ -2807,10 +2807,10 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub p->hookstate = MGCP_ONHOOK; break; case 406: - ast_log(LOG_NOTICE, "Transaction %d timed out\n", ident); + ast_log(LOG_NOTICE, "Transaction %u timed out\n", ident); break; case 407: - ast_log(LOG_NOTICE, "Transaction %d aborted\n", ident); + ast_log(LOG_NOTICE, "Transaction %u aborted\n", ident); break; } if (sub) { @@ -2963,7 +2963,7 @@ static void start_rtp(struct mgcp_subchannel *sub) ast_rtp_instance_set_prop(sub->rtp, AST_RTP_PROPERTY_NAT, sub->nat); } /* Make a call*ID */ - snprintf(sub->callid, sizeof(sub->callid), "%08lx%s", ast_random(), sub->txident); + snprintf(sub->callid, sizeof(sub->callid), "%08lx%s", (unsigned long)ast_random(), sub->txident); /* Transmit the connection create */ if(!sub->parent->pktcgatealloc) { transmit_connect_with_sdp(sub, NULL); @@ -4198,7 +4198,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS, AST_EVENT_IE_END); } - snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random()); + snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", (unsigned long)ast_random()); e->msgstate = -1; e->amaflags = amaflags; ast_format_cap_copy(e->cap, global_capability); @@ -4227,7 +4227,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) e->hookstate = MGCP_ONHOOK; e->chanvars = copy_vars(chanvars); if (!ep_reload) { - /*snprintf(txident, sizeof(txident), "%08lx", ast_random());*/ + /*snprintf(txident, sizeof(txident), "%08lx", (unsigned long)ast_random());*/ for (i = 0; i < MAX_SUBS; i++) { sub = ast_calloc(1, sizeof(*sub)); if (sub) { @@ -4236,7 +4236,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) ast_mutex_init(&sub->cx_queue_lock); sub->parent = e; sub->id = i; - snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random()); + snprintf(sub->txident, sizeof(sub->txident), "%08lx", (unsigned long)ast_random()); /*stnrcpy(sub->txident, txident, sizeof(sub->txident) - 1);*/ sub->cxmode = MGCP_CX_INACTIVE; sub->nat = nat; @@ -4338,7 +4338,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) e->onhooktime = time(NULL); /* ASSUME we're onhook */ e->hookstate = MGCP_ONHOOK; - snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random()); + snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", (unsigned long)ast_random()); } for (i = 0, sub = NULL; i < MAX_SUBS; i++) { @@ -4360,7 +4360,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v) ast_copy_string(sub->magic, MGCP_SUBCHANNEL_MAGIC, sizeof(sub->magic)); sub->parent = e; sub->id = i; - snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random()); + snprintf(sub->txident, sizeof(sub->txident), "%08lx", (unsigned long)ast_random()); sub->cxmode = MGCP_CX_INACTIVE; sub->next = e->sub; e->sub = sub; diff --git a/channels/chan_motif.c b/channels/chan_motif.c index 751e33a23d..a197dc700e 100644 --- a/channels/chan_motif.c +++ b/channels/chan_motif.c @@ -567,7 +567,7 @@ static struct jingle_session *jingle_alloc(struct jingle_endpoint *endpoint, con } if (ast_strlen_zero(sid)) { - ast_string_field_build(session, sid, "%08lx%08lx", ast_random(), ast_random()); + ast_string_field_build(session, sid, "%08lx%08lx", (unsigned long)ast_random(), (unsigned long)ast_random()); session->outgoing = 1; ast_string_field_set(session, audio_name, "audio"); ast_string_field_set(session, video_name, "video"); @@ -622,7 +622,7 @@ static struct ast_channel *jingle_new(struct jingle_endpoint *endpoint, struct j return NULL; } - if (!(chan = ast_channel_alloc(1, state, S_OR(title, ""), S_OR(cid_name, ""), "", "", "", linkedid, 0, "Motif/%s-%04lx", str, ast_random() & 0xffff))) { + if (!(chan = ast_channel_alloc(1, state, S_OR(title, ""), S_OR(cid_name, ""), "", "", "", linkedid, 0, "Motif/%s-%04lx", str, (unsigned long)(ast_random() & 0xffff)))) { return NULL; } @@ -776,13 +776,13 @@ static int jingle_add_ice_udp_candidates_to_transport(struct ast_rtp_instance *r break; } - snprintf(tmp, sizeof(tmp), "%d", candidate->id); + snprintf(tmp, sizeof(tmp), "%u", candidate->id); iks_insert_attrib(local_candidate, "component", tmp); snprintf(tmp, sizeof(tmp), "%d", ast_str_hash(candidate->foundation)); iks_insert_attrib(local_candidate, "foundation", tmp); iks_insert_attrib(local_candidate, "generation", "0"); iks_insert_attrib(local_candidate, "network", "0"); - snprintf(tmp, sizeof(tmp), "%04lx", ast_random() & 0xffff); + snprintf(tmp, sizeof(tmp), "%04lx", (unsigned long)(ast_random() & 0xffff)); iks_insert_attrib(local_candidate, "id", tmp); iks_insert_attrib(local_candidate, "ip", ast_sockaddr_stringify_host(&candidate->address)); iks_insert_attrib(local_candidate, "port", ast_sockaddr_stringify_port(&candidate->address)); @@ -1174,7 +1174,7 @@ static int jingle_add_payloads_to_description(struct jingle_session *session, st if ((format.id == AST_FORMAT_G722) && ((session->transport == JINGLE_TRANSPORT_GOOGLE_V1) || (session->transport == JINGLE_TRANSPORT_GOOGLE_V2))) { iks_insert_attrib(payload, "clockrate", "16000"); } else { - snprintf(tmp, sizeof(tmp), "%d", ast_rtp_lookup_sample_rate2(1, &format, 0)); + snprintf(tmp, sizeof(tmp), "%u", ast_rtp_lookup_sample_rate2(1, &format, 0)); iks_insert_attrib(payload, "clockrate", tmp); } @@ -1550,7 +1550,7 @@ static int jingle_write(struct ast_channel *ast, struct ast_frame *frame) } break; default: - ast_log(LOG_WARNING, "Can't send %d type frames with Jingle write\n", + ast_log(LOG_WARNING, "Can't send %u type frames with Jingle write\n", frame->frametype); return 0; } @@ -1980,7 +1980,7 @@ static int jingle_interpret_ice_udp_transport(struct jingle_session *session, ik } if ((sscanf(component, "%30u", &local_candidate.id) != 1) || - (sscanf(priority, "%30u", &local_candidate.priority) != 1) || + (sscanf(priority, "%30u", (unsigned *)&local_candidate.priority) != 1) || (sscanf(port, "%30d", &real_port) != 1)) { jingle_queue_hangup_with_cause(session, AST_CAUSE_PROTOCOL_ERROR); ast_log(LOG_ERROR, "Invalid ICE-UDP candidate information received on session '%s'\n", session->sid); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 0f050f6c9e..3d5c7d28e2 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -529,7 +529,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast) ast_setstate(ast, AST_STATE_UP); return &p->fr; } else - ast_log(LOG_WARNING, "Got off hook in weird state %d\n", ast_channel_state(ast)); + ast_log(LOG_WARNING, "Got off hook in weird state %u\n", ast_channel_state(ast)); } } #if 1 @@ -658,7 +658,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame) /* Write a frame of (presumably voice) data */ if (frame->frametype != AST_FRAME_VOICE && p->mode != MODE_FXS) { if (frame->frametype != AST_FRAME_IMAGE) - ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype); + ast_log(LOG_WARNING, "Don't know what to do with frame type '%u'\n", frame->frametype); return 0; } if (!(frame->subclass.format.id == AST_FORMAT_G723_1 || diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2125f068ca..6fe8e6b38d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -811,7 +811,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 ast_event_sub *network_change_event_subscription; /*!< subscription id for network change events */ static struct ast_event_sub *acl_change_event_subscription; /*!< subscription id for named ACL system change events */ @@ -3202,7 +3202,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); } } } @@ -3452,7 +3452,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; } @@ -3460,7 +3460,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 */ } @@ -3905,7 +3905,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? @@ -4263,7 +4263,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 */ @@ -4988,7 +4988,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: @@ -5005,7 +5005,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; @@ -5749,7 +5749,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) : ""); + ast_debug(2, "T38 state changed to %u on channel %s\n", p->t38.state, chan ? ast_channel_name(chan) : ""); /* If no channel was provided we can't send off a control frame */ if (!chan) @@ -7375,7 +7375,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; } @@ -7905,7 +7905,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, linkedid, 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, linkedid, 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"); @@ -8349,7 +8349,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); @@ -8473,7 +8473,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; } @@ -8573,13 +8573,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 */ @@ -8879,7 +8879,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 * @@ -9813,8 +9813,8 @@ static int get_ip_and_port_from_sdp(struct sip_request *req, const enum media_ty const char *c; int miterator = req->sdp_start; int citerator = req->sdp_start; - int x = 0; - int numberofports; + unsigned int x = 0; + unsigned int numberofports; int len; int af; char proto[4], host[258] = ""; /*Initialize to empty so we will know if we have any input */ @@ -9937,7 +9937,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; @@ -9945,7 +9945,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 */ @@ -10061,7 +10061,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; @@ -10106,7 +10106,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)) { @@ -10177,7 +10177,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); @@ -10210,7 +10210,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)) { @@ -10256,7 +10256,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); } @@ -10288,7 +10288,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)) { @@ -10320,7 +10320,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); } @@ -10952,7 +10952,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; @@ -10964,7 +10964,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; @@ -11054,7 +11054,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; @@ -11090,18 +11090,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 %255s", &codec, fmtp_string) == 2) { struct ast_format *format; @@ -11119,7 +11119,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; @@ -11129,7 +11129,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; @@ -11139,7 +11139,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; @@ -11156,7 +11156,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); @@ -11169,19 +11169,19 @@ static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_ if (!strncasecmp(mimeSubtype, "H26", 3) || !strncasecmp(mimeSubtype, "MP4", 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; @@ -11201,7 +11201,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; @@ -11219,25 +11219,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; @@ -11269,10 +11269,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; @@ -11301,7 +11301,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 '%u'\n", x, p->t38_maxdatagram); x = p->t38_maxdatagram; } ast_debug(3, "FaxMaxDatagram: %u\n", x); @@ -11309,7 +11309,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxfillbitremoval", 20) == 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; } @@ -11320,7 +11320,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxtranscodingmmr", 20) == 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; } @@ -11331,7 +11331,7 @@ static int process_sdp_a_image(const char *a, struct sip_pvt *p) found = TRUE; } else if ((strncmp(attrib, "t38faxtranscodingjbig", 21) == 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; } @@ -11424,7 +11424,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)) { @@ -12648,7 +12648,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 @@ -12749,7 +12749,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)) || @@ -12763,7 +12763,7 @@ static void add_codec_to_sdp(const struct sip_pvt *p, } else /* I don't see how you couldn't have p->rtp, but good to check for and error out if not there like earlier code */ 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, 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); @@ -12816,7 +12816,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)) || @@ -12825,7 +12825,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); ast_format_sdp_generate(format, rtp_code, a_buf); } @@ -12841,13 +12841,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 */ @@ -12893,12 +12893,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... */ @@ -13374,8 +13374,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"); } @@ -14204,7 +14204,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) : ""); + ast_debug(1, "T38 is in state %u on channel %s\n", p->t38.state, p->owner ? ast_channel_name(p->owner) : ""); add_sdp(&req, p, FALSE, FALSE, TRUE); } else if (p->rtp) { try_suggested_sip_codec(p); @@ -14707,7 +14707,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; } @@ -15648,7 +15648,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"; } } @@ -16348,7 +16348,7 @@ static void build_route(struct sip_pvt *p, struct sip_request *req, int backward 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; } } @@ -20084,7 +20084,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))); @@ -20215,7 +20215,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); @@ -20726,7 +20726,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 @@ -20740,10 +20740,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))); @@ -21926,7 +21926,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 == SIP_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); @@ -21984,7 +21984,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); @@ -21996,7 +21996,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); @@ -22165,7 +22165,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; @@ -25164,7 +25164,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 { @@ -25934,7 +25934,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; } @@ -28272,7 +28272,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)) { @@ -30058,7 +30058,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; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index c1de81a631..6aa94a9b37 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1858,7 +1858,7 @@ static struct ast_variable *add_var(const char *buf, struct ast_variable *list) static int skinny_sched_del(int sched_id, struct skinny_subchannel *sub) { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Deleting SCHED %d\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Deleting SCHED %d\n", sub->callid, sched_id); return ast_sched_del(sched, sched_id); } @@ -1867,7 +1867,7 @@ static int skinny_sched_add(int when, ast_sched_cb callback, struct skinny_subch { int ret; ret = ast_sched_add(sched, when, callback, sub); - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Added SCHED %d\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Added SCHED %d\n", sub->callid, ret); return ret; } @@ -2419,7 +2419,7 @@ static void transmit_connect(struct skinny_device *d, struct skinny_subchannel * req->data.openreceivechannel.echo = htolel(0); req->data.openreceivechannel.bitrate = htolel(0); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting OPEN_RECEIVE_CHANNEL_MESSAGE to %s, confid %d, partyid %d, ms %d, fmt %d, echo %d, brate %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting OPEN_RECEIVE_CHANNEL_MESSAGE to %s, confid %u, partyid %u, ms %d, fmt %d, echo %d, brate %d\n", d->name, sub->callid, sub->callid, fmt.cur_ms, codec_ast2skinny(&fmt.format), 0, 0); transmit_response(d, req); } @@ -2613,7 +2613,7 @@ static void transmit_closereceivechannel(struct skinny_device *d, struct skinny_ req->data.closereceivechannel.conferenceId = htolel(0); req->data.closereceivechannel.partyId = htolel(sub->callid); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CLOSE_RECEIVE_CHANNEL_MESSAGE to %s, confid %d, callid %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CLOSE_RECEIVE_CHANNEL_MESSAGE to %s, confid %d, callid %u\n", d->name, 0, sub->callid); transmit_response(d, req); } @@ -2628,7 +2628,7 @@ static void transmit_stopmediatransmission(struct skinny_device *d, struct skinn req->data.stopmedia.conferenceId = htolel(0); req->data.stopmedia.passThruPartyId = htolel(sub->callid); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting STOP_MEDIA_TRANSMISSION_MESSAGE to %s, confid %d, passthrupartyid %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting STOP_MEDIA_TRANSMISSION_MESSAGE to %s, confid %d, passthrupartyid %u\n", d->name, 0, sub->callid); transmit_response(d, req); } @@ -2665,7 +2665,7 @@ static void transmit_startmediatransmission(struct skinny_device *d, struct skin req->data.startmedia_ip6.qualifier.bitRate = htolel(0); } - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting START_MEDIA_TRANSMISSION_MESSAGE to %s, callid %d, passthrupartyid %d, ip %s:%d, ms %d, fmt %d, prec 127\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting START_MEDIA_TRANSMISSION_MESSAGE to %s, callid %u, passthrupartyid %u, ip %s:%d, ms %d, fmt %d, prec 127\n", d->name, sub->callid, sub->callid, ast_inet_ntoa(dest.sin_addr), dest.sin_port, fmt.cur_ms, codec_ast2skinny(&fmt.format)); transmit_response(d, req); } @@ -2695,7 +2695,7 @@ static void transmit_callstate(struct skinny_device *d, int buttonInstance, unsi req->data.callstate.lineInstance = htolel(buttonInstance); req->data.callstate.callReference = htolel(callid); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_STATE_MESSAGE to %s, state %s, inst %d, callid %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting CALL_STATE_MESSAGE to %s, state %s, inst %d, callid %u\n", d->name, callstate2str(state), buttonInstance, callid); transmit_response(d, req); } @@ -2807,7 +2807,7 @@ static void transmit_definetimedate(struct skinny_device *d) req->data.definetimedate.milliseconds = htolel(cmtime.tm_usec / 1000); req->data.definetimedate.timestamp = htolel(now.tv_sec); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DEFINETIMEDATE_MESSAGE to %s, date %d %d %d dow %d time %d:%d:%d.%d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting DEFINETIMEDATE_MESSAGE to %s, date %u %u %u dow %u time %u:%u:%u.%u\n", d->name, req->data.definetimedate.year, req->data.definetimedate.month, req->data.definetimedate.day, req->data.definetimedate.dayofweek, req->data.definetimedate.hour, req->data.definetimedate.minute, req->data.definetimedate.seconds, req->data.definetimedate.milliseconds); transmit_response(d, req); @@ -2892,7 +2892,7 @@ static void transmit_softkeytemplateres(struct skinny_device *d) soft_key_template_default, sizeof(soft_key_template_default)); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting SOFT_KEY_TEMPLATE_RES_MESSAGE to %s, offset 0, keycnt %d, totalkeycnt %d, template data\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting SOFT_KEY_TEMPLATE_RES_MESSAGE to %s, offset 0, keycnt %u, totalkeycnt %u, template data\n", d->name, req->data.softkeytemplate.softKeyCount, req->data.softkeytemplate.totalSoftKeyCount); transmit_response(d, req); } @@ -2943,9 +2943,9 @@ static void transmit_registerack(struct skinny_device *d) #ifdef AST_DEVMODE { short res = req->data.regack.res[0] << 8 | req->data.regack.res[1]; - int res2 = req->data.regack.res2[0] << 24 | req->data.regack.res2[1] << 16 | req->data.regack.res2[2] << 8 | req->data.regack.res2[3]; + unsigned int res2 = req->data.regack.res2[0] << 24 | req->data.regack.res2[1] << 16 | req->data.regack.res2[2] << 8 | req->data.regack.res2[3]; SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting REGISTER_ACK_MESSAGE to %s, keepalive %d, datetemplate %s, seckeepalive %d, res 0x%04x, res2 0x%08x\n", - d->name, keep_alive, date_format, keep_alive, res, res2); + d->name, keep_alive, date_format, keep_alive, (unsigned)res, res2); } #endif @@ -2973,7 +2973,7 @@ static void transmit_backspace(struct skinny_device *d, int instance, unsigned c req->data.bkspmessage.instance = htolel(instance); req->data.bkspmessage.callreference = htolel(callid); - SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting BKSP_REQ_MESSAGE to %s, inst %d, callid %d \n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Transmitting BKSP_REQ_MESSAGE to %s, inst %d, callid %u \n", d->name, instance, callid); transmit_response(d, req); } @@ -3105,7 +3105,7 @@ static void update_connectedline(struct skinny_subchannel *sub, const void *data || ast_strlen_zero(ast_channel_connected(c)->id.number.str)) return; - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Updating\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Updating\n", sub->callid); send_callinfo(sub); } @@ -4247,13 +4247,13 @@ static void start_rtp(struct skinny_subchannel *sub) static void destroy_rtp(struct skinny_subchannel *sub) { if (sub->rtp) { - SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying RTP\n", sub->callid); + SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %u - Destroying RTP\n", sub->callid); ast_rtp_instance_stop(sub->rtp); ast_rtp_instance_destroy(sub->rtp); sub->rtp = NULL; } if (sub->vrtp) { - SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %d - Destroying VRTP\n", sub->callid); + SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %u - Destroying VRTP\n", sub->callid); ast_rtp_instance_stop(sub->vrtp); ast_rtp_instance_destroy(sub->vrtp); sub->vrtp = NULL; @@ -4284,7 +4284,7 @@ static void *skinny_newcall(void *data) if (!sub->rtp) { start_rtp(sub); } - ast_verb(3, "Sub %d - Calling %s@%s\n", sub->callid, ast_channel_exten(c), ast_channel_context(c)); + ast_verb(3, "Sub %u - Calling %s@%s\n", sub->callid, ast_channel_exten(c), ast_channel_context(c)); res = ast_pbx_run(c); if (res) { ast_log(LOG_WARNING, "PBX exited non-zero\n"); @@ -4300,7 +4300,7 @@ static void skinny_dialer(struct skinny_subchannel *sub, int timedout) struct skinny_device *d = l->device; if (timedout || !ast_matchmore_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Force dialing '%s'\n", sub->callid, sub->exten); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Force dialing '%s'\n", sub->callid, sub->exten); if (ast_exists_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) { if (sub->substate == SUBSTATE_OFFHOOK) { dialandactivatesub(sub, sub->exten); @@ -4313,7 +4313,7 @@ static void skinny_dialer(struct skinny_subchannel *sub, int timedout) dumpsub(sub, 0); } } else { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Wait for more digits\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Wait for more digits\n", sub->callid); if (ast_exists_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) { sub->dialer_sched = skinny_sched_add(matchdigittimeout, skinny_dialer_cb, sub); } else { @@ -4325,7 +4325,7 @@ static void skinny_dialer(struct skinny_subchannel *sub, int timedout) static int skinny_dialer_cb(const void *data) { struct skinny_subchannel *sub = (struct skinny_subchannel *)data; - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Dialer called from SCHED %d\n", sub->callid, sub->dialer_sched); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dialer called from SCHED %d\n", sub->callid, sub->dialer_sched); sub->dialer_sched = 0; skinny_dialer(sub, 1); return 0; @@ -4358,7 +4358,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout) return -1; } - SKINNY_DEBUG(DEBUG_SUB, 3, "Skinny Call (%s) - Sub %d\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Skinny Call (%s) - Sub %u\n", ast_channel_name(ast), sub->callid); if (l->dnd) { @@ -4387,7 +4387,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout) sub->aa_mute = 1; } } - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - setting autoanswer time=%dms %s%s\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - setting autoanswer time=%dms %s%s\n", sub->callid, aatime, sub->aa_beep ? "BEEP " : "", sub->aa_mute ? "MUTE" : ""); if (aatime) { //sub->aa_sched = ast_sched_add(sched, aatime, skinny_autoanswer_cb, sub); @@ -4417,7 +4417,7 @@ static int skinny_hangup(struct ast_channel *ast) dumpsub(sub, 1); - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Destroying\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Destroying\n", sub->callid); ast_mutex_lock(&sub->lock); sub->owner = NULL; @@ -4435,7 +4435,7 @@ static int skinny_answer(struct ast_channel *ast) struct skinny_subchannel *sub = ast_channel_tech_pvt(ast); if (sub->blindxfer) { - SKINNY_DEBUG(DEBUG_SUB, 3, "skinny_answer(%s) on %s@%s-%d with BlindXFER, transferring\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "skinny_answer(%s) on %s@%s-%u with BlindXFER, transferring\n", ast_channel_name(ast), sub->line->name, sub->line->device->name, sub->callid); ast_setstate(ast, AST_STATE_UP); skinny_transfer(sub); @@ -4444,7 +4444,7 @@ static int skinny_answer(struct ast_channel *ast) sub->cxmode = SKINNY_CX_SENDRECV; - SKINNY_DEBUG(DEBUG_SUB, 3, "skinny_answer(%s) on %s@%s-%d\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "skinny_answer(%s) on %s@%s-%u\n", ast_channel_name(ast), sub->line->name, sub->line->device->name, sub->callid); setsubstate(sub, SUBSTATE_CONNECTED); @@ -4518,7 +4518,7 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame) if (frame->frametype == AST_FRAME_IMAGE) { return 0; } else { - ast_log(LOG_WARNING, "Can't send %d type frames with skinny_write\n", frame->frametype); + ast_log(LOG_WARNING, "Can't send %u type frames with skinny_write\n", frame->frametype); return 0; } } else { @@ -4743,12 +4743,12 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s return -1; } - SKINNY_DEBUG(DEBUG_SUB, 3, "Asked to indicate '%s' condition on channel %s (Sub %d)\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Asked to indicate '%s' condition on channel %s (Sub %u)\n", control2str(ind), ast_channel_name(ast), sub->callid); switch(ind) { case AST_CONTROL_RINGING: if (sub->blindxfer) { - SKINNY_DEBUG(DEBUG_SUB, 3, "Channel %s (Sub %d) set up for Blind Xfer, so Xfer rather than ring device\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Channel %s (Sub %u) set up for Blind Xfer, so Xfer rather than ring device\n", ast_channel_name(ast), sub->callid); skinny_transfer(sub); break; @@ -5079,7 +5079,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) return; case SUBSTATE_HOLD: if (sub->substate != SUBSTATE_CONNECTED) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_HOLD from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_HOLD from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } transmit_activatecallplane(d, l); @@ -5098,7 +5098,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) return; default: - ast_log(LOG_WARNING, "Substate handling under subline for state %d not implemented on Sub-%d\n", state, sub->callid); + ast_log(LOG_WARNING, "Substate handling under subline for state %d not implemented on Sub-%u\n", state, sub->callid); } } @@ -5109,7 +5109,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) transmit_speaker_mode(d, SKINNY_SPEAKERON); } - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - change state from %s to %s\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - change state from %s to %s\n", sub->callid, substate2str(sub->substate), substate2str(actualstate)); if (actualstate == sub->substate) { @@ -5120,7 +5120,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) switch (actualstate) { case SUBSTATE_OFFHOOK: - ast_verb(1, "Call-id: %d\n", sub->callid); + ast_verb(1, "Call-id: %u\n", sub->callid); l->activesub = sub; transmit_callstate(d, l->instance, sub->callid, SKINNY_OFFHOOK); transmit_activatecallplane(d, l); @@ -5170,7 +5170,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_DIALING: if (ast_strlen_zero(sub->exten) || !ast_exists_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) { - ast_log(LOG_WARNING, "Exten (%s)@(%s) does not exist, unable to set substate DIALING on sub %d\n", sub->exten, ast_channel_context(c), sub->callid); + ast_log(LOG_WARNING, "Exten (%s)@(%s) does not exist, unable to set substate DIALING on sub %u\n", sub->exten, ast_channel_context(c), sub->callid); return; } @@ -5213,7 +5213,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_RINGOUT: if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS)) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_RINGOUT from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_RINGOUT from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } if (sub->substate != SUBSTATE_PROGRESS) { @@ -5299,7 +5299,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_BUSY: if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS || sub->substate == SUBSTATE_RINGOUT)) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_BUSY from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_BUSY from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } @@ -5313,7 +5313,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_CONGESTION: if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS || sub->substate == SUBSTATE_RINGOUT)) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_CONGESTION from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_CONGESTION from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } @@ -5327,7 +5327,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_PROGRESS: if (sub->substate != SUBSTATE_DIALING) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_PROGRESS from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_PROGRESS from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } @@ -5341,7 +5341,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) break; case SUBSTATE_HOLD: if (sub->substate != SUBSTATE_CONNECTED) { - ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_HOLD from %s (on call-%d)\n", substate2str(sub->substate), sub->callid); + ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_HOLD from %s (on call-%u)\n", substate2str(sub->substate), sub->callid); return; } ast_queue_control_data(sub->owner, AST_CONTROL_HOLD, @@ -5358,7 +5358,7 @@ static void setsubstate(struct skinny_subchannel *sub, int state) sub->substate = SUBSTATE_HOLD; break; default: - ast_log(LOG_WARNING, "Was asked to change to nonexistant substate %d on Sub-%d\n", state, sub->callid); + ast_log(LOG_WARNING, "Was asked to change to nonexistant substate %d on Sub-%u\n", state, sub->callid); } } @@ -5369,7 +5369,7 @@ static void dumpsub(struct skinny_subchannel *sub, int forcehangup) struct skinny_subchannel *activate_sub = NULL; struct skinny_subchannel *tsub; - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Dumping\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dumping\n", sub->callid); if (!forcehangup && sub->substate == SUBSTATE_HOLD) { l->activesub = NULL; @@ -5384,7 +5384,7 @@ static void dumpsub(struct skinny_subchannel *sub, int forcehangup) setsubstate(sub, SUBSTATE_ONHOOK); l->activesub = activate_sub; if (l->activesub->substate != SUBSTATE_HOLD) { - ast_log(LOG_WARNING, "Sub-%d was related but not at SUBSTATE_HOLD\n", sub->callid); + ast_log(LOG_WARNING, "Sub-%u was related but not at SUBSTATE_HOLD\n", sub->callid); return; } setsubstate(l->activesub, SUBSTATE_HOLD); @@ -5418,7 +5418,7 @@ static void activatesub(struct skinny_subchannel *sub, int state) { struct skinny_line *l = sub->line; - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Activating, and deactivating sub %d\n", + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Activating, and deactivating sub %u\n", sub->callid, l->activesub ? l->activesub->callid : 0); ast_channel_lock(sub->owner); @@ -5447,7 +5447,7 @@ static void dialandactivatesub(struct skinny_subchannel *sub, char exten[AST_MAX struct skinny_device *d = l->device; // FIXME: needs some love and remove sleeps - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Set callforward to %s\n", sub->callid, exten); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Set callforward to %s\n", sub->callid, exten); set_callforwards(l, sub->exten, l->getforward); transmit_start_tone(d, SKINNY_DIALTONE, l->instance, sub->callid); transmit_lamp_indication(d, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON); @@ -5459,7 +5459,7 @@ static void dialandactivatesub(struct skinny_subchannel *sub, char exten[AST_MAX l->getforward = 0; dumpsub(sub, 0); } else { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Dial %s and Activate\n", sub->callid, exten); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Dial %s and Activate\n", sub->callid, exten); ast_copy_string(sub->exten, exten, sizeof(sub->exten)); activatesub(sub, SUBSTATE_DIALING); } @@ -5635,7 +5635,7 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses if ((sub->owner && ast_channel_state(sub->owner) < AST_STATE_UP)) { if (sub->dialer_sched && !skinny_sched_del(sub->dialer_sched, sub)) { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Got a digit and not timed out, so try dialing\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Got a digit and not timed out, so try dialing\n", sub->callid); sub->dialer_sched = 0; len = strlen(sub->exten); if (len == 0) { @@ -5652,12 +5652,12 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses skinny_dialer(sub, 0); } } else { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d Got a digit already timedout, ignore\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u Got a digit already timedout, ignore\n", sub->callid); /* Timed out so the call is being progressed elsewhere, to late for digits */ return 0; } } else { - SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Got a digit and sending as DTMF\n", sub->callid); + SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %u - Got a digit and sending as DTMF\n", sub->callid); f.subclass.integer = dgt; f.src = "skinny"; if (sub->owner) { @@ -6684,7 +6684,7 @@ static int handle_message(struct skinny_req *req, struct skinnysession *s) transmit_keepaliveack(s->device); break; case REGISTER_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received REGISTER_MESSAGE from %s, name %s, type %d, protovers %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received REGISTER_MESSAGE from %s, name %s, type %u, protovers %d\n", d->name, req->data.reg.name, letohl(req->data.reg.type), letohl(req->data.reg.protocolVersion)); if (skinny_register(req, s)) { ast_atomic_fetchadd_int(&unauth_sessions, -1); @@ -6701,7 +6701,7 @@ static int handle_message(struct skinny_req *req, struct skinnysession *s) res = handle_ip_port_message(req, s); break; case KEYPAD_BUTTON_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received KEYPAD_BUTTON_MESSAGE from %s, digit %d, inst %d, callref %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received KEYPAD_BUTTON_MESSAGE from %s, digit %u, inst %u, callref %u\n", d->name, letohl(req->data.keypad.button), letohl(req->data.keypad.lineInstance), letohl(req->data.keypad.callReference)); res = handle_keypad_button_message(req, s); break; @@ -6715,29 +6715,29 @@ static int handle_message(struct skinny_req *req, struct skinnysession *s) res = handle_stimulus_message(req, s); break; case OFFHOOK_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received OFFHOOK_MESSAGE from %s, inst %d, ref %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received OFFHOOK_MESSAGE from %s, inst %u, ref %u\n", d->name, letohl(req->data.offhook.instance), letohl(req->data.offhook.reference)); res = handle_offhook_message(req, s); break; case ONHOOK_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received ONHOOK_MESSAGE from %s, inst %d, ref %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received ONHOOK_MESSAGE from %s, inst %u, ref %u\n", d->name, letohl(req->data.offhook.instance), letohl(req->data.offhook.reference)); res = handle_onhook_message(req, s); break; case CAPABILITIES_RES_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET | DEBUG_AUDIO, 3, "Received CAPABILITIES_RES_MESSAGE from %s, count %d, codec data\n", + SKINNY_DEBUG(DEBUG_PACKET | DEBUG_AUDIO, 3, "Received CAPABILITIES_RES_MESSAGE from %s, count %u, codec data\n", d->name, letohl(req->data.caps.count)); res = handle_capabilities_res_message(req, s); break; case SPEED_DIAL_STAT_REQ_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SPEED_DIAL_STAT_REQ_MESSAGE from %s, sdNum %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SPEED_DIAL_STAT_REQ_MESSAGE from %s, sdNum %u\n", d->name, letohl(req->data.speeddialreq.speedDialNumber)); if ( (sd = find_speeddial_by_instance(s->device, letohl(req->data.speeddialreq.speedDialNumber), 0)) ) { transmit_speeddialstatres(d, sd); } break; case LINE_STATE_REQ_MESSAGE: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received LINE_STATE_REQ_MESSAGE from %s, lineNum %d\n", + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received LINE_STATE_REQ_MESSAGE from %s, lineNum %u\n", d->name, letohl(req->data.line.lineNumber)); transmit_linestatres(d, letohl(req->data.line.lineNumber)); break; @@ -6792,7 +6792,7 @@ static int handle_message(struct skinny_req *req, struct skinnysession *s) SKINNY_DEBUG(DEBUG_PACKET, 3, "Received REGISTER_AVAILABLE_LINES_MESSAGE from %s\n", d->name); break; default: - SKINNY_DEBUG(DEBUG_PACKET, 3, "Received UNKNOWN_MESSAGE(%x) from %s\n", letohl(req->e), d->name); + SKINNY_DEBUG(DEBUG_PACKET, 3, "Received UNKNOWN_MESSAGE(%x) from %s\n", (unsigned)letohl(req->e), d->name); break; } if (res >= 0 && req) diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index cb0a231da3..66d282b382 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -847,7 +847,7 @@ static const char *ustmtext(const char *str, struct unistimsession *pte) static void display_last_error(const char *sz_msg) { /* Display the error message */ - ast_log(LOG_WARNING, "%s : (%u) %s\n", sz_msg, errno, strerror(errno)); + ast_log(LOG_WARNING, "%s : (%d) %s\n", sz_msg, errno, strerror(errno)); } static unsigned int get_tick_count(void) @@ -937,7 +937,7 @@ static void send_client(int size, const unsigned char *data, struct unistimsessi /*#ifdef DUMP_PACKET */ if (unistimdebug) { - ast_verb(6, "Sending datas with seq #0x%.4x Using slot #%d :\n", pte->seq_server, buf_pos); + ast_verb(6, "Sending datas with seq #0x%.4x Using slot #%d :\n", (unsigned)pte->seq_server, buf_pos); } /*#endif */ send_raw_client(pte->wsabufsend[buf_pos].len, pte->wsabufsend[buf_pos].buf, &(pte->sin), @@ -1093,7 +1093,7 @@ static void send_icon(unsigned char pos, unsigned char status, struct unistimses { BUFFSEND; if (unistimdebug) { - ast_verb(0, "Sending icon pos %d with status 0x%.2x\n", pos, status); + ast_verb(0, "Sending icon pos %d with status 0x%.2x\n", pos, (unsigned)status); } memcpy(buffsend + SIZE_HEADER, packet_send_icon, sizeof(packet_send_icon)); buffsend[9] = pos; @@ -1165,7 +1165,7 @@ send_favorite(unsigned char pos, unsigned char status, struct unistimsession *pt int i; if (unistimdebug) { - ast_verb(0, "Sending favorite pos %d with status 0x%.2x\n", pos, status); + ast_verb(0, "Sending favorite pos %d with status 0x%.2x\n", pos, (unsigned)status); } memcpy(buffsend + SIZE_HEADER, packet_send_favorite, sizeof(packet_send_favorite)); buffsend[10] = pos; @@ -1377,7 +1377,7 @@ static void close_client(struct unistimsession *s) ast_queue_hangup_with_cause(sub->owner, AST_CAUSE_NETWORK_OUT_OF_ORDER); } else { if (unistimdebug) { - ast_debug(1, "Released sub %d of channel %s@%s\n", sub->subtype, sub->parent->name, s->device->name); + ast_debug(1, "Released sub %u of channel %s@%s\n", sub->subtype, sub->parent->name, s->device->name); } AST_LIST_REMOVE_CURRENT(list); unistim_free_sub(sub); @@ -1431,7 +1431,7 @@ static int send_retransmit(struct unistimsession *pte) if (i < 0) { ast_log(LOG_WARNING, "Asked to retransmit an ACKed slot ! last_buf_available=%d, seq_server = #0x%.4x last_seq_ack = #0x%.4x\n", - pte->last_buf_available, pte->seq_server, pte->last_seq_ack); + pte->last_buf_available, (unsigned)pte->seq_server, (unsigned)pte->last_seq_ack); continue; } @@ -1441,7 +1441,7 @@ static int send_retransmit(struct unistimsession *pte) seq = ntohs(sbuf[1]); ast_verb(0, "Retransmit slot #%d (seq=#0x%.4x), last ack was #0x%.4x\n", i, - seq, pte->last_seq_ack); + (unsigned)seq, (unsigned)pte->last_seq_ack); } send_raw_client(pte->wsabufsend[i].len, pte->wsabufsend[i].buf, &pte->sin, &pte->sout); @@ -1522,7 +1522,7 @@ static void send_led_update(struct unistimsession *pte, unsigned char led) { BUFFSEND; if (unistimdebug) { - ast_verb(0, "Sending led_update (%x)\n", led); + ast_verb(0, "Sending led_update (%x)\n", (unsigned)led); } memcpy(buffsend + SIZE_HEADER, packet_send_led_update, sizeof(packet_send_led_update)); buffsend[9] = led; @@ -1538,8 +1538,8 @@ send_select_output(struct unistimsession *pte, unsigned char output, unsigned ch { BUFFSEND; if (unistimdebug) { - ast_verb(0, "Sending select output packet output=%x volume=%x mute=%x\n", output, - volume, mute); + ast_verb(0, "Sending select output packet output=%x volume=%x mute=%x\n", + (unsigned)output, (unsigned)volume, (unsigned)mute); } memcpy(buffsend + SIZE_HEADER, packet_send_select_output, sizeof(packet_send_select_output)); @@ -1843,7 +1843,7 @@ static struct unistim_line *unistim_line_alloc(void) static int unistim_free_sub(struct unistim_subchannel *sub) { if (unistimdebug) { - ast_debug(1, "Released sub %d of channel %s@%s\n", sub->subtype, sub->parent->name, sub->parent->parent->name); + ast_debug(1, "Released sub %u of channel %s@%s\n", sub->subtype, sub->parent->name, sub->parent->parent->name); } ast_mutex_destroy(&sub->lock); ast_free(sub); @@ -1942,7 +1942,7 @@ static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf) char addrmac[19]; int res = 0; for (tmp = 15; tmp < 15 + SIZE_HEADER; tmp++) { - sprintf(&addrmac[i], "%.2x", (unsigned char) buf[tmp]); + sprintf(&addrmac[i], "%.2x", (unsigned) buf[tmp]); i += 2; } if (unistimdebug) { @@ -2035,7 +2035,7 @@ static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf) pte->state = STATE_AUTHDENY; break; default: - ast_log(LOG_WARNING, "Internal error : unknown autoprovisioning value = %d\n", + ast_log(LOG_WARNING, "Internal error : unknown autoprovisioning value = %u\n", autoprovisioning); } } @@ -2088,7 +2088,7 @@ static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf) pte->state = STATE_MAINPAGE; break; default: - ast_log(LOG_WARNING, "Internal error, extension value unknown : %d\n", + ast_log(LOG_WARNING, "Internal error, extension value unknown : %u\n", pte->device->extension); pte->state = STATE_AUTHDENY; break; @@ -2827,7 +2827,7 @@ static void send_dial_tone(struct unistimsession *pte) ast_tone_zone_part_parse(s, &tone_data); send_tone(pte, tone_data.freq1, tone_data.freq2); if (unistimdebug) { - ast_verb(0, "Country code found (%s), freq1=%d freq2=%d\n", + ast_verb(0, "Country code found (%s), freq1=%u freq2=%u\n", pte->device->tz->country, tone_data.freq1, tone_data.freq2); } ts = ast_tone_zone_sound_unref(ts); @@ -3064,7 +3064,7 @@ static void handle_call_outgoing(struct unistimsession *s) return; } if (unistimdebug) { - ast_verb(0, "Started three way call on channel %p (%s) subchan %d\n", + ast_verb(0, "Started three way call on channel %p (%s) subchan %u\n", sub_trans->owner, ast_channel_name(sub_trans->owner), sub_trans->subtype); } return; @@ -4375,7 +4375,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession char keycode = buf[13]; if (unistimdebug) { - ast_verb(0, "Key pressed: keycode = 0x%.2x - current state: %s\n", keycode, + ast_verb(0, "Key pressed: keycode = 0x%.2x - current state: %s\n", (unsigned)keycode, ptestate_tostr(pte->state)); } switch (pte->state) { @@ -4541,14 +4541,14 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, } if (buf[5] != 2) { ast_log(LOG_NOTICE, "%s Wrong direction : got 0x%.2x expected 0x02\n", tmpbuf, - buf[5]); + (unsigned)buf[5]); return; } seq = ntohs(sbuf[1]); if (buf[4] == 1) { ast_mutex_lock(&pte->lock); if (unistimdebug) { - ast_verb(6, "ACK received for packet #0x%.4x\n", seq); + ast_verb(6, "ACK received for packet #0x%.4x\n", (unsigned)seq); } pte->nb_retransmit = 0; @@ -4565,7 +4565,7 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, } else { ast_log(LOG_NOTICE, "%s Warning : ACK received for an already ACKed packet : #0x%.4x we are at #0x%.4x\n", - tmpbuf, seq, pte->last_seq_ack); + tmpbuf, (unsigned)seq, (unsigned)pte->last_seq_ack); } ast_mutex_unlock(&pte->lock); return; @@ -4573,13 +4573,13 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, if (pte->seq_server < seq) { ast_log(LOG_NOTICE, "%s Error : ACK received for a non-existent packet : #0x%.4x\n", - tmpbuf, pte->seq_server); + tmpbuf, (unsigned)pte->seq_server); ast_mutex_unlock(&pte->lock); return; } if (unistimdebug) { ast_verb(0, "%s ACK gap : Received ACK #0x%.4x, previous was #0x%.4x\n", - tmpbuf, seq, pte->last_seq_ack); + tmpbuf, (unsigned)seq, (unsigned)pte->last_seq_ack); } pte->last_seq_ack = seq; check_send_queue(pte); @@ -4603,7 +4603,7 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, if (pte->seq_phone > seq) { ast_log(LOG_NOTICE, "%s Warning : received a retransmitted packet : #0x%.4x (we are at #0x%.4x)\n", - tmpbuf, seq, pte->seq_phone); + tmpbuf, (unsigned)seq, (unsigned)pte->seq_phone); /* BUG ? pte->device->seq_phone = seq; */ /* Send ACK */ buf[4] = 1; @@ -4613,28 +4613,28 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, } ast_log(LOG_NOTICE, "%s Warning : we lost a packet : received #0x%.4x (we are at #0x%.4x)\n", - tmpbuf, seq, pte->seq_phone); + tmpbuf, (unsigned)seq, (unsigned)pte->seq_phone); return; } if (buf[4] == 0) { - ast_log(LOG_NOTICE, "%s Retransmit request for packet #0x%.4x\n", tmpbuf, seq); + ast_log(LOG_NOTICE, "%s Retransmit request for packet #0x%.4x\n", tmpbuf, (unsigned)seq); if (pte->last_seq_ack > seq) { ast_log(LOG_NOTICE, "%s Error : received a request for an already ACKed packet : #0x%.4x\n", - tmpbuf, pte->last_seq_ack); + tmpbuf, (unsigned)pte->last_seq_ack); return; } if (pte->seq_server < seq) { ast_log(LOG_NOTICE, "%s Error : received a request for a non-existent packet : #0x%.4x\n", - tmpbuf, pte->seq_server); + tmpbuf, (unsigned)pte->seq_server); return; } send_retransmit(pte); return; } ast_log(LOG_NOTICE, "%s Unknown request : got 0x%.2x expected 0x00,0x01 or 0x02\n", - tmpbuf, buf[4]); + tmpbuf, (unsigned)buf[4]); return; } @@ -5004,7 +5004,7 @@ static struct ast_frame *unistim_rtp_read(const struct ast_channel *ast, } if (!sub->rtp) { - ast_log(LOG_WARNING, "RTP handle NULL while reading on subchannel %d\n", + ast_log(LOG_WARNING, "RTP handle NULL while reading on subchannel %u\n", sub->subtype); return &ast_null_frame; } @@ -5061,7 +5061,7 @@ static int unistim_write(struct ast_channel *ast, struct ast_frame *frame) if (frame->frametype == AST_FRAME_IMAGE) { return 0; } else { - ast_log(LOG_WARNING, "Can't send %d type frames with unistim_write\n", + ast_log(LOG_WARNING, "Can't send %u type frames with unistim_write\n", frame->frametype); return 0; } @@ -5096,7 +5096,7 @@ static int unistim_fixup(struct ast_channel *oldchan, struct ast_channel *newcha ast_mutex_lock(&p->lock); - ast_debug(1, "New owner for channel USTM/%s@%s-%d is %s\n", l->name, + ast_debug(1, "New owner for channel USTM/%s@%s-%u is %s\n", l->name, l->parent->name, p->subtype, ast_channel_name(newchan)); if (p->owner != oldchan) { @@ -5578,7 +5578,7 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state tmp = ast_channel_alloc(1, state, l->cid_num, NULL, l->accountcode, l->exten, l->parent->context, linkedid, l->amaflags, "USTM/%s@%s-%p", l->name, l->parent->name, sub); if (unistimdebug) { - ast_verb(0, "unistim_new sub=%d (%p) chan=%p line=%s\n", sub->subtype, sub, tmp, l->name); + ast_verb(0, "unistim_new sub=%u (%p) chan=%p line=%s\n", sub->subtype, sub, tmp, l->name); } if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); @@ -5923,7 +5923,7 @@ static char *unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_ continue; } ast_cli(a->fd, "==> %d. dev=%s icon=%#-4x label=%-10s number=%-5s sub=%p line=%p\n", - i, device->softkeydevice[i], device->softkeyicon[i], device->softkeylabel[i], device->softkeynumber[i], + i, device->softkeydevice[i], (unsigned)device->softkeyicon[i], device->softkeylabel[i], device->softkeynumber[i], device->ssub[i], device->sline[i]); } device = device->next; @@ -5934,7 +5934,7 @@ static char *unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_ s = sessions; while (s) { ast_cli(a->fd, - "sin=%s timeout=%u state=%s macaddr=%s device=%p session=%p\n", + "sin=%s timeout=%d state=%s macaddr=%s device=%p session=%p\n", ast_inet_ntoa(s->sin.sin_addr), s->timeout, ptestate_tostr(s->state), s->macaddr, s->device, s); s = s->next; @@ -6200,7 +6200,7 @@ static int parse_bookmark(const char *text, struct unistim_device *d) ast_copy_string(d->softkeynumber[p], number, sizeof(d->softkeynumber[p])); if (unistimdebug) { ast_verb(0, "New bookmark at pos %d label='%s' number='%s' icon=%#x\n", - p, d->softkeylabel[p], d->softkeynumber[p], d->softkeyicon[p]); + p, d->softkeylabel[p], d->softkeynumber[p], (unsigned)d->softkeyicon[p]); } return 1; } diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c index 5f54e083b3..74444a409b 100644 --- a/channels/iax2-parser.c +++ b/channels/iax2-parser.c @@ -97,7 +97,7 @@ static void dump_string_hex(char *output, int maxlen, void *value, int len) int i = 0; while (len-- && (i + 1) * 4 < maxlen) { - sprintf(output + (4 * i), "\\x%2.2x", *((unsigned char *)value + i)); + sprintf(output + (4 * i), "\\x%2.2x", (unsigned)*((unsigned char *)value + i)); i++; } } @@ -1123,7 +1123,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen) ies->osptokenblock[count] = (char *)data + 2 + 1; ies->ospblocklength[count] = len - 1; } else { - snprintf(tmp, (int)sizeof(tmp), "Expected OSP token block index to be 0~%d but was %d\n", IAX_MAX_OSPBLOCK_NUM - 1, count); + snprintf(tmp, (int)sizeof(tmp), "Expected OSP token block index to be 0~%d but was %u\n", IAX_MAX_OSPBLOCK_NUM - 1, count); errorf(tmp); } break; diff --git a/channels/sig_analog.c b/channels/sig_analog.c index ca0724a893..cb18f95477 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -335,7 +335,7 @@ static void analog_swap_subs(struct analog_pvt *p, enum analog_sub a, enum analo int tinthreeway; struct ast_channel *towner; - ast_debug(1, "Swapping %d and %d\n", a, b); + ast_debug(1, "Swapping %u and %u\n", a, b); towner = p->subs[a].owner; p->subs[a].owner = p->subs[b].owner; @@ -1597,7 +1597,7 @@ void analog_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum anal ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n", f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End", - f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); + (unsigned)f->subclass.integer, f->subclass.integer, ast_channel_name(ast)); if (analog_check_confirmanswer(p)) { if (f->frametype == AST_FRAME_DTMF_END) { @@ -2696,7 +2696,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ res = analog_get_event(p); - ast_debug(1, "Got event %s(%d) on channel %d (index %d)\n", analog_event2str(res), res, p->channel, idx); + ast_debug(1, "Got event %s(%d) on channel %d (index %u)\n", analog_event2str(res), res, p->channel, idx); if (res & (ANALOG_EVENT_PULSEDIGIT | ANALOG_EVENT_DTMFUP)) { analog_set_pulsedial(p, (res & ANALOG_EVENT_PULSEDIGIT) ? 1 : 0); @@ -2878,7 +2878,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } mssinceflash = ast_tvdiff_ms(ast_tvnow(), p->flashtime); - ast_debug(1, "Last flash was %d ms ago\n", mssinceflash); + ast_debug(1, "Last flash was %u ms ago\n", mssinceflash); if (mssinceflash < MIN_MS_SINCE_FLASH) { /* It hasn't been long enough since the last flashook. This is probably a bounce on hanging up. Hangup both channels now */ @@ -2928,7 +2928,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } } } else { - ast_log(LOG_WARNING, "Got a hangup and my index is %d?\n", idx); + ast_log(LOG_WARNING, "Got a hangup and my index is %u?\n", idx); } /* Fall through */ default: @@ -3041,7 +3041,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } break; default: - ast_log(LOG_WARNING, "FXO phone off hook in weird state %d??\n", ast_channel_state(ast)); + ast_log(LOG_WARNING, "FXO phone off hook in weird state %u??\n", ast_channel_state(ast)); } break; case ANALOG_SIG_FXSLS: @@ -3093,7 +3093,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } /* Fall through */ default: - ast_log(LOG_WARNING, "Ring/Off-hook in strange state %d on channel %d\n", ast_channel_state(ast), p->channel); + ast_log(LOG_WARNING, "Ring/Off-hook in strange state %u on channel %d\n", ast_channel_state(ast), p->channel); break; } break; @@ -3152,7 +3152,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ case ANALOG_SIG_FXOLS: case ANALOG_SIG_FXOGS: case ANALOG_SIG_FXOKS: - ast_debug(1, "Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n", + ast_debug(1, "Winkflash, index: %u, normal: %d, callwait: %d, thirdcall: %d\n", idx, analog_get_sub_fd(p, ANALOG_SUB_REAL), analog_get_sub_fd(p, ANALOG_SUB_CALLWAIT), analog_get_sub_fd(p, ANALOG_SUB_THREEWAY)); /* Cancel any running CallerID spill */ @@ -3160,7 +3160,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ p->callwaitcas = 0; if (idx != ANALOG_SUB_REAL) { - ast_log(LOG_WARNING, "Got flash hook with index %d on channel %d?!?\n", idx, p->channel); + ast_log(LOG_WARNING, "Got flash hook with index %u on channel %d?!?\n", idx, p->channel); goto winkflashdone; } @@ -3376,7 +3376,7 @@ winkflashdone: if (p->dialing) { ast_debug(1, "Ignoring wink on channel %d\n", p->channel); } else { - ast_debug(1, "Got wink in weird state %d on channel %d\n", ast_channel_state(ast), p->channel); + ast_debug(1, "Got wink in weird state %u on channel %d\n", ast_channel_state(ast), p->channel); } break; case ANALOG_SIG_FEATDMF_TA: @@ -3516,7 +3516,7 @@ winkflashdone: case AST_STATE_PRERING: /*!< Channel has detected an incoming call and is waiting for ring */ default: if (p->answeronpolarityswitch || p->hanguponpolarityswitch) { - ast_debug(1, "Ignoring Polarity switch on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Ignoring Polarity switch on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } break; } @@ -3527,20 +3527,20 @@ winkflashdone: case AST_STATE_DIALING: /*!< Digits (or equivalent) have been dialed */ case AST_STATE_RINGING: /*!< Remote end is ringing */ if (p->answeronpolarityswitch) { - ast_debug(1, "Polarity switch detected but NOT answering (too close to OffHook event) on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Polarity switch detected but NOT answering (too close to OffHook event) on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } break; case AST_STATE_UP: /*!< Line is up */ case AST_STATE_RING: /*!< Line is ringing */ if (p->hanguponpolarityswitch) { - ast_debug(1, "Polarity switch detected but NOT hanging up (too close to Answer event) on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Polarity switch detected but NOT hanging up (too close to Answer event) on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } break; default: if (p->answeronpolarityswitch || p->hanguponpolarityswitch) { - ast_debug(1, "Polarity switch detected (too close to previous event) on channel %d, state %d\n", p->channel, ast_channel_state(ast)); + ast_debug(1, "Polarity switch detected (too close to previous event) on channel %d, state %u\n", p->channel, ast_channel_state(ast)); } break; } @@ -3548,7 +3548,7 @@ winkflashdone: } /* Added more log_debug information below to provide a better indication of what is going on */ - ast_debug(1, "Polarity Reversal event occured - DEBUG 2: channel %d, state %d, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); + ast_debug(1, "Polarity Reversal event occured - DEBUG 2: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64 "\n", p->channel, ast_channel_state(ast), p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) ); break; default: ast_debug(1, "Dunno what to do with event %d on channel %d\n", res, p->channel); diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 624441fc85..fef2d8d787 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -690,15 +690,15 @@ static void sig_pri_set_subaddress(struct ast_party_subaddress *ast_subaddress, ptr = cnum; len = pri_subaddress->length - 1; /* -1 account for zero based indexing */ for (x = 0; x < len; ++x) { - ptr += sprintf(ptr, "%02x", pri_subaddress->data[x]); + ptr += sprintf(ptr, "%02x", (unsigned)pri_subaddress->data[x]); } if (pri_subaddress->odd_even_indicator) { /* ODD */ - sprintf(ptr, "%01x", (pri_subaddress->data[len]) >> 4); + sprintf(ptr, "%01x", (unsigned)((pri_subaddress->data[len]) >> 4)); } else { /* EVEN */ - sprintf(ptr, "%02x", pri_subaddress->data[len]); + sprintf(ptr, "%02x", (unsigned)pri_subaddress->data[len]); } ast_subaddress->str = cnum; } @@ -2245,7 +2245,7 @@ static void sig_pri_event_party_id(struct ast_str **msg, const char *prefix, str /* Party number */ ast_str_append(msg, 0, "%sNumValid: %d\r\n", prefix, - (unsigned) party->number.valid); + party->number.valid); ast_str_append(msg, 0, "%sNum: %s\r\n", prefix, S_COR(party->number.valid, party->number.str, "")); ast_str_append(msg, 0, "%ston: %d\r\n", prefix, party->number.plan); @@ -2258,7 +2258,7 @@ static void sig_pri_event_party_id(struct ast_str **msg, const char *prefix, str /* Party name */ ast_str_append(msg, 0, "%sNameValid: %d\r\n", prefix, - (unsigned) party->name.valid); + party->name.valid); ast_str_append(msg, 0, "%sName: %s\r\n", prefix, S_COR(party->name.valid, party->name.str, "")); if (party->name.valid) { @@ -5167,7 +5167,7 @@ static void sig_pri_moh_fsm_event(struct ast_channel *chan, struct sig_pri_chan if (orig_state < SIG_PRI_MOH_STATE_IDLE || SIG_PRI_MOH_STATE_NUM <= orig_state || !sig_pri_moh_fsm[orig_state]) { /* Programming error: State not implemented. */ - ast_log(LOG_ERROR, "MOH state not implemented: %s(%d)\n", + ast_log(LOG_ERROR, "MOH state not implemented: %s(%u)\n", sig_pri_moh_state_str(orig_state), orig_state); return; } @@ -7901,7 +7901,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd if (p->pri->facilityenable) pri_facility_enable(p->pri->pri); - ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", ast_channel_transfercapability(ast), ast_transfercapability2str(ast_channel_transfercapability(ast))); + ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", (unsigned)ast_channel_transfercapability(ast), ast_transfercapability2str(ast_channel_transfercapability(ast))); dp_strip = 0; pridialplan = p->pri->dialplan - 1; if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */ @@ -8661,7 +8661,7 @@ int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char } if (pvt->call_level < SIG_PRI_CALL_LEVEL_CONNECT) { ast_log(LOG_WARNING, - "Span %d: Digit '%c' may be ignored by peer. (Call level:%d(%s))\n", + "Span %d: Digit '%c' may be ignored by peer. (Call level:%u(%s))\n", pvt->pri->span, digit, pvt->call_level, sig_pri_call_level2str(pvt->call_level)); } diff --git a/channels/sip/config_parser.c b/channels/sip/config_parser.c index fe34283afb..f86971c5b7 100644 --- a/channels/sip/config_parser.c +++ b/channels/sip/config_parser.c @@ -684,7 +684,7 @@ int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum s } if (port) { - if (!sscanf(port, "%5u", portnum)) { + if (!sscanf(port, "%5d", portnum)) { if (lineno) { ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno); } else { diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h index ff6733d0a3..99a0dae33d 100644 --- a/channels/sip/include/sip.h +++ b/channels/sip/include/sip.h @@ -1111,7 +1111,7 @@ struct sip_pvt { int noncodeccapability; /*!< DTMF RFC2833 telephony-event */ int jointnoncodeccapability; /*!< Joint Non codec capability */ int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */ - int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */ + unsigned int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */ int request_queue_sched_id; /*!< Scheduler ID of any scheduled action to process queued requests */ int provisional_keepalive_sched_id; /*!< Scheduler ID for provisional responses that need to be sent out to avoid cancellation */ const char *last_provisional; /*!< The last successfully transmitted provisonal response message */ @@ -1327,7 +1327,7 @@ struct sip_peer { int ringing; /*!< Number of calls ringing */ int onhold; /*!< Peer has someone on hold */ int call_limit; /*!< Limit of concurrent calls */ - int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */ + unsigned int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */ int busy_level; /*!< Level of active channels where we signal busy */ int maxforwards; /*!< SIP Loop prevention */ enum transfermodes allowtransfer; /*! SIP Refer restriction scheme */ diff --git a/formats/format_pcm.c b/formats/format_pcm.c index b763b55925..1ee333fba5 100644 --- a/formats/format_pcm.c +++ b/formats/format_pcm.c @@ -304,24 +304,24 @@ static int check_header(FILE *f) /* data_size = ltohl(header[AU_HDR_DATA_SIZE_OFF]); */ encoding = ltohl(header[AU_HDR_ENCODING_OFF]); if (encoding != AU_ENC_8BIT_ULAW) { - ast_log(LOG_WARNING, "Unexpected format: %d. Only 8bit ULAW allowed (%d)\n", encoding, AU_ENC_8BIT_ULAW); + ast_log(LOG_WARNING, "Unexpected format: %u. Only 8bit ULAW allowed (%d)\n", encoding, AU_ENC_8BIT_ULAW); return -1; } sample_rate = ltohl(header[AU_HDR_SAMPLE_RATE_OFF]); if (sample_rate != DEFAULT_SAMPLE_RATE) { - ast_log(LOG_WARNING, "Sample rate can only be 8000 not %d\n", sample_rate); + ast_log(LOG_WARNING, "Sample rate can only be 8000 not %u\n", sample_rate); return -1; } channels = ltohl(header[AU_HDR_CHANNELS_OFF]); if (channels != 1) { - ast_log(LOG_WARNING, "Not in mono: channels=%d\n", channels); + ast_log(LOG_WARNING, "Not in mono: channels=%u\n", channels); return -1; } /* Skip to data */ fseek(f, 0, SEEK_END); data_size = ftell(f) - hdr_size; if (fseek(f, hdr_size, SEEK_SET) == -1 ) { - ast_log(LOG_WARNING, "Failed to skip to data: %d\n", hdr_size); + ast_log(LOG_WARNING, "Failed to skip to data: %u\n", hdr_size); return -1; } return data_size; diff --git a/funcs/func_env.c b/funcs/func_env.c index a2f7c2bd25..16f9a7445c 100644 --- a/funcs/func_env.c +++ b/funcs/func_env.c @@ -291,7 +291,7 @@ static int stat_read(struct ast_channel *chan, const char *cmd, char *data, strcpy(buf, "1"); break; case 's': - snprintf(buf, len, "%d", (unsigned int) s.st_size); + snprintf(buf, len, "%u", (unsigned int) s.st_size); break; case 'f': snprintf(buf, len, "%d", S_ISREG(s.st_mode) ? 1 : 0); @@ -309,7 +309,7 @@ static int stat_read(struct ast_channel *chan, const char *cmd, char *data, snprintf(buf, len, "%d", (int) s.st_ctime); break; case 'm': - snprintf(buf, len, "%o", (int) s.st_mode); + snprintf(buf, len, "%o", s.st_mode); break; } } @@ -699,7 +699,7 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, stru if (fread(fbuf, 1, i + sizeof(fbuf) > flength ? flength - i : sizeof(fbuf), ff) < (i + sizeof(fbuf) > flength ? flength - i : sizeof(fbuf))) { ast_log(LOG_ERROR, "Short read?!!\n"); } - ast_debug(3, "Appending first %" PRId64" bytes of fbuf=%s\n", i + sizeof(fbuf) > length_offset ? length_offset - i : sizeof(fbuf), fbuf); + ast_debug(3, "Appending first %" PRId64" bytes of fbuf=%s\n", (long)(i + sizeof(fbuf) > length_offset ? length_offset - i : sizeof(fbuf)), fbuf); ast_str_append_substr(buf, len, fbuf, i + sizeof(fbuf) > length_offset ? length_offset - i : sizeof(fbuf)); } } else if (length == 0) { diff --git a/funcs/func_hangupcause.c b/funcs/func_hangupcause.c index d85c54e165..0f1c41adb7 100644 --- a/funcs/func_hangupcause.c +++ b/funcs/func_hangupcause.c @@ -128,7 +128,7 @@ static int hangupcause_read(struct ast_channel *chan, const char *cmd, char *dat AST_STANDARD_APP_ARGS(args, parms); if (args.argc != 2) { /* Must have two arguments. */ - ast_log(LOG_WARNING, "The HANGUPCAUSE function must have 2 parameters, not %d\n", args.argc); + ast_log(LOG_WARNING, "The HANGUPCAUSE function must have 2 parameters, not %u\n", args.argc); return -1; } diff --git a/funcs/func_iconv.c b/funcs/func_iconv.c index 4c4f65f1ac..c3d02865cc 100644 --- a/funcs/func_iconv.c +++ b/funcs/func_iconv.c @@ -95,7 +95,7 @@ static int iconv_read(struct ast_channel *chan, const char *cmd, char *arguments AST_STANDARD_APP_ARGS(args, parse); if (args.argc < 3) { - ast_log(LOG_WARNING, "Syntax: ICONV(,,) %d\n", args.argc); + ast_log(LOG_WARNING, "Syntax: ICONV(,,) %u\n", args.argc); return -1; } diff --git a/funcs/func_srv.c b/funcs/func_srv.c index deb94835fa..3786a2fa2a 100644 --- a/funcs/func_srv.c +++ b/funcs/func_srv.c @@ -236,11 +236,11 @@ static int srv_result_read(struct ast_channel *chan, const char *cmd, char *data if (!strcasecmp(args.field, "host")) { ast_copy_string(buf, host, len); } else if (!strcasecmp(args.field, "port")) { - snprintf(buf, len, "%u", port); + snprintf(buf, len, "%d", port); } else if (!strcasecmp(args.field, "priority")) { - snprintf(buf, len, "%u", priority); + snprintf(buf, len, "%d", priority); } else if (!strcasecmp(args.field, "weight")) { - snprintf(buf, len, "%u", weight); + snprintf(buf, len, "%d", weight); } else { ast_log(LOG_WARNING, "Unrecognized SRV field '%s'\n", args.field); return -1; diff --git a/funcs/func_sysinfo.c b/funcs/func_sysinfo.c index dce392f29f..8da94dd334 100644 --- a/funcs/func_sysinfo.c +++ b/funcs/func_sysinfo.c @@ -115,15 +115,15 @@ static int sysinfo_helper(struct ast_channel *chan, const char *cmd, char *data, else if (!strcasecmp("uptime", data)) { /* in hours */ snprintf(buf, len, "%ld", sys_info.uptime/3600); } else if (!strcasecmp("totalram", data)) { /* in KiB */ - snprintf(buf, len, "%ld",(sys_info.totalram * sys_info.mem_unit)/1024); + snprintf(buf, len, "%lu",(sys_info.totalram * sys_info.mem_unit)/1024); } else if (!strcasecmp("freeram", data)) { /* in KiB */ - snprintf(buf, len, "%ld",(sys_info.freeram * sys_info.mem_unit)/1024); + snprintf(buf, len, "%lu",(sys_info.freeram * sys_info.mem_unit)/1024); } else if (!strcasecmp("bufferram", data)) { /* in KiB */ - snprintf(buf, len, "%ld",(sys_info.bufferram * sys_info.mem_unit)/1024); + snprintf(buf, len, "%lu",(sys_info.bufferram * sys_info.mem_unit)/1024); } else if (!strcasecmp("totalswap", data)) { /* in KiB */ - snprintf(buf, len, "%ld",(sys_info.totalswap * sys_info.mem_unit)/1024); + snprintf(buf, len, "%lu",(sys_info.totalswap * sys_info.mem_unit)/1024); } else if (!strcasecmp("freeswap", data)) { /* in KiB */ - snprintf(buf, len, "%ld",(sys_info.freeswap * sys_info.mem_unit)/1024); + snprintf(buf, len, "%lu",(sys_info.freeswap * sys_info.mem_unit)/1024); } else if (!strcasecmp("numprocs", data)) { snprintf(buf, len, "%d", sys_info.procs); } diff --git a/include/asterisk/astobj.h b/include/asterisk/astobj.h index d32a7d0e14..a18d70658f 100644 --- a/include/asterisk/astobj.h +++ b/include/asterisk/astobj.h @@ -798,7 +798,7 @@ extern "C" { * refcount fields of an object to the specfied string buffer. */ #define ASTOBJ_DUMP(s,slen,obj) \ - snprintf((s),(slen),"name: %s\nobjflags: %d\nrefcount: %d\n\n", (obj)->name, (obj)->objflags, (obj)->refcount); + snprintf((s),(slen),"name: %s\nobjflags: %u\nrefcount: %u\n\n", (obj)->name, (obj)->objflags, (obj)->refcount); /*! \brief Dump information about all the objects in a container to a file descriptor. * diff --git a/main/abstract_jb.c b/main/abstract_jb.c index 08ba9e2441..2153cb2d87 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -282,7 +282,7 @@ int ast_jb_put(struct ast_channel *chan, struct ast_frame *f) /* We consider an enabled jitterbuffer should receive frames with valid timing info. */ if (!ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO) || f->len < 2 || f->ts < 0) { ast_log(LOG_WARNING, "%s received frame with invalid timing info: " - "has_timing_info=%d, len=%ld, ts=%ld, src=%s\n", + "has_timing_info=%u, len=%ld, ts=%ld, src=%s\n", ast_channel_name(chan), ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO), f->len, f->ts, f->src); return -1; } diff --git a/main/acl.c b/main/acl.c index 60806f4ded..ff93ba62c4 100644 --- a/main/acl.c +++ b/main/acl.c @@ -717,7 +717,7 @@ struct ast_ha *ast_append_ha(const char *sense, const char *stuff, struct ast_ha parsed_addr = ast_strdupa(ast_sockaddr_stringify(&ha->addr)); parsed_mask = ast_strdupa(ast_sockaddr_stringify(&ha->netmask)); - ast_debug(3, "%s/%s sense %d appended to ACL\n", parsed_addr, parsed_mask, ha->sense); + ast_debug(3, "%s/%s sense %u appended to ACL\n", parsed_addr, parsed_mask, ha->sense); } return ret; diff --git a/main/adsi.c b/main/adsi.c index bb8570af39..fcbbd11c5b 100644 --- a/main/adsi.c +++ b/main/adsi.c @@ -341,7 +341,7 @@ void ast_adsi_install_funcs(const struct adsi_funcs *funcs) { if (funcs && funcs->version < current_adsi_version) { ast_log(LOG_WARNING, "Cannot install ADSI function pointers due to version mismatch." - "Ours: %u, Theirs: %u\n", current_adsi_version, funcs->version); + "Ours: %d, Theirs: %u\n", current_adsi_version, funcs->version); return; } diff --git a/main/aoc.c b/main/aoc.c index 8a51509258..1e21dd8207 100644 --- a/main/aoc.c +++ b/main/aoc.c @@ -1431,7 +1431,7 @@ static void aoc_d_event(const struct ast_aoc_decoded *decoded, struct ast_channe decoded->unit_list[idx].amount); } if (decoded->unit_list[idx].valid_type) { - ast_str_append(msg, 0, "%s/TypeOf: %d\r\n", prefix, + ast_str_append(msg, 0, "%s/TypeOf: %u\r\n", prefix, decoded->unit_list[idx].type); } } @@ -1499,7 +1499,7 @@ static void aoc_e_event(const struct ast_aoc_decoded *decoded, struct ast_channe decoded->unit_list[idx].amount); } if (decoded->unit_list[idx].valid_type) { - ast_str_append(msg, 0, "%s/TypeOf: %d\r\n", prefix, + ast_str_append(msg, 0, "%s/TypeOf: %u\r\n", prefix, decoded->unit_list[idx].type); } } diff --git a/main/app.c b/main/app.c index 084eb15dfb..aa7cedc996 100644 --- a/main/app.c +++ b/main/app.c @@ -808,7 +808,7 @@ static void linear_release(struct ast_channel *chan, void *params) struct linear_state *ls = params; if (ls->origwfmt.id && ast_set_write_format(chan, &ls->origwfmt)) { - ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", ast_channel_name(chan), ls->origwfmt.id); + ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%u'\n", ast_channel_name(chan), ls->origwfmt.id); } if (ls->autoclose) { @@ -1723,7 +1723,7 @@ static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path) s = ast_alloca(lp + 10); fs = ast_alloca(lp + 20); - snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random()); + snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, (unsigned long)ast_random()); fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, AST_FILE_MODE); if (fd < 0) { ast_log(LOG_ERROR, "Unable to create lock file '%s': %s\n", path, strerror(errno)); @@ -2101,7 +2101,7 @@ static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, ast_stopstream(chan); return res; default: - ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action); + ast_log(LOG_NOTICE, "Unknown dispatch function %u, ignoring!\n", option->action); return 0; } return -1; diff --git a/main/asterisk.c b/main/asterisk.c index b555a6fb7a..660fe2af53 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -695,14 +695,14 @@ static char *handle_show_sysinfo(struct ast_cli_entry *e, int cmd, struct ast_cl ast_cli(a->fd, "\nSystem Statistics\n"); ast_cli(a->fd, "-----------------\n"); - ast_cli(a->fd, " System Uptime: %lu hours\n", uptime); + ast_cli(a->fd, " System Uptime: %ld hours\n", uptime); ast_cli(a->fd, " Total RAM: %" PRIu64 " KiB\n", physmem / 1024); ast_cli(a->fd, " Free RAM: %" PRIu64 " KiB\n", freeram); #if defined(HAVE_SYSINFO) ast_cli(a->fd, " Buffer RAM: %" PRIu64 " KiB\n", ((uint64_t) sys_info.bufferram * sys_info.mem_unit) / 1024); #endif #if defined (HAVE_SYSCTL) || defined(HAVE_SWAPCTL) - ast_cli(a->fd, " Total Swap Space: %u KiB\n", totalswap); + ast_cli(a->fd, " Total Swap Space: %d KiB\n", totalswap); ast_cli(a->fd, " Free Swap Space: %" PRIu64 " KiB\n\n", freeswap); #endif ast_cli(a->fd, " Number of Processes: %d \n\n", nprocs); @@ -1569,7 +1569,7 @@ static int ast_makesocket(void) ast_log(LOG_WARNING, "Unable to change ownership of %s: %s\n", ast_config_AST_SOCKET, strerror(errno)); if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) { - int p1; + unsigned int p1; mode_t p; sscanf(ast_config_AST_CTL_PERMISSIONS, "%30o", &p1); p = p1; diff --git a/main/audiohook.c b/main/audiohook.c index 679e27c1ad..a649fbee3a 100644 --- a/main/audiohook.c +++ b/main/audiohook.c @@ -260,7 +260,7 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho if (!usable_read && !usable_write) { /* If both factories are unusable bail out */ - ast_debug(1, "Read factory %p and write factory %p both fail to provide %zd samples\n", &audiohook->read_factory, &audiohook->write_factory, samples); + ast_debug(1, "Read factory %p and write factory %p both fail to provide %zu samples\n", &audiohook->read_factory, &audiohook->write_factory, samples); return NULL; } @@ -973,7 +973,7 @@ int ast_channel_audiohook_count_by_source(struct ast_channel *chan, const char * } break; default: - ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type); + ast_debug(1, "Invalid audiohook type supplied, (%u)\n", type); return -1; } @@ -1008,7 +1008,7 @@ int ast_channel_audiohook_count_by_source_running(struct ast_channel *chan, cons } break; default: - ast_debug(1, "Invalid audiohook type supplied, (%d)\n", type); + ast_debug(1, "Invalid audiohook type supplied, (%u)\n", type); return -1; } return count; diff --git a/main/bridging.c b/main/bridging.c index 465d0339fe..47d55b6044 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -417,7 +417,7 @@ static struct ast_bridge_technology *find_best_technology(uint32_t capabilities) continue; } if (best && best->preference < current->preference) { - ast_debug(1, "Bridge technology %s has preference %d while %s has preference %d. Skipping.\n", current->name, current->preference, best->name, best->preference); + ast_debug(1, "Bridge technology %s has preference %u while %s has preference %u. Skipping.\n", current->name, current->preference, best->name, best->preference); continue; } best = current; @@ -1054,15 +1054,15 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann /* Restore original formats of the channel as they came in */ if (ast_format_cmp(ast_channel_readformat(bridge_channel->chan), &formats[0]) == AST_FORMAT_CMP_NOT_EQUAL) { - ast_debug(1, "Bridge is returning %p to read format %s(%d)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id); + ast_debug(1, "Bridge is returning %p to read format %s(%u)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id); if (ast_set_read_format(bridge_channel->chan, &formats[0])) { - ast_debug(1, "Bridge failed to return channel %p to read format %s(%d)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id); + ast_debug(1, "Bridge failed to return channel %p to read format %s(%u)\n", bridge_channel, ast_getformatname(&formats[0]), formats[0].id); } } if (ast_format_cmp(ast_channel_writeformat(bridge_channel->chan), &formats[1]) == AST_FORMAT_CMP_NOT_EQUAL) { - ast_debug(1, "Bridge is returning %p to write format %s(%d)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id); + ast_debug(1, "Bridge is returning %p to write format %s(%u)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id); if (ast_set_write_format(bridge_channel->chan, &formats[1])) { - ast_debug(1, "Bridge failed to return channel %p to write format %s(%d)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id); + ast_debug(1, "Bridge failed to return channel %p to write format %s(%u)\n", bridge_channel, ast_getformatname(&formats[1]), formats[1].id); } } @@ -1429,7 +1429,7 @@ int ast_bridge_features_enable(struct ast_bridge_features *features, enum ast_br dtmf = builtin_features_dtmf[feature]; /* If no DTMF is still available (ie: it has been disabled) then error out now */ if (ast_strlen_zero(dtmf)) { - ast_debug(1, "Failed to enable built in feature %d on %p, no DTMF string is available for it.\n", feature, features); + ast_debug(1, "Failed to enable built in feature %u on %p, no DTMF string is available for it.\n", feature, features); return -1; } } diff --git a/main/callerid.c b/main/callerid.c index a0e13e5f2e..56815f4c37 100644 --- a/main/callerid.c +++ b/main/callerid.c @@ -447,7 +447,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s case 0x06: /* short dial number */ case 0x07: /* reserved */ default: /* reserved */ - ast_debug(2, "cid info:#1=%X\n", cid->rawdata[x]); + ast_debug(2, "cid info:#1=%X\n", (unsigned)cid->rawdata[x]); break ; } x++; @@ -463,7 +463,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s case 0x09: /* private dial plan */ case 0x05: /* reserved */ default: /* reserved */ - ast_debug(2, "cid info:#2=%X\n", cid->rawdata[x]); + ast_debug(2, "cid info:#2=%X\n", (unsigned)cid->rawdata[x]); break ; } x++; @@ -503,7 +503,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s case 0x07: /* reserved */ default: /* reserved */ if (option_debug > 1) - ast_log(LOG_NOTICE, "did info:#1=%X\n", cid->rawdata[x]); + ast_log(LOG_NOTICE, "did info:#1=%X\n", (unsigned)cid->rawdata[x]); break ; } x++; @@ -519,7 +519,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, s case 0x09: /* private dial plan */ case 0x05: /* reserved */ default: /* reserved */ - ast_debug(2, "did info:#2=%X\n", cid->rawdata[x]); + ast_debug(2, "did info:#2=%X\n", (unsigned)cid->rawdata[x]); break ; } x++; diff --git a/main/ccss.c b/main/ccss.c index b1585312ef..feee7cc8f4 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -1974,7 +1974,7 @@ static struct ast_cc_monitor *cc_extension_monitor_init(const char * const exten cc_interface->monitor_class = AST_CC_EXTENSION_MONITOR; strcpy(cc_interface->device_name, ast_str_buffer(str)); monitor->interface = cc_interface; - ast_log_dynamic_level(cc_logger_level, "Created an extension cc interface for '%s' with id %d and parent %d\n", cc_interface->device_name, monitor->id, monitor->parent_id); + ast_log_dynamic_level(cc_logger_level, "Created an extension cc interface for '%s' with id %u and parent %u\n", cc_interface->device_name, monitor->id, monitor->parent_id); return monitor; } @@ -2153,7 +2153,7 @@ static struct ast_cc_monitor *cc_device_monitor_init(const char * const device_n monitor->interface = cc_interface; monitor->available_timer_id = -1; ast_cc_copy_config_params(cc_interface->config_params, &cc_data->config_params); - ast_log_dynamic_level(cc_logger_level, "Core %d: Created a device cc interface for '%s' with id %d and parent %d\n", + ast_log_dynamic_level(cc_logger_level, "Core %d: Created a device cc interface for '%s' with id %u and parent %u\n", monitor->core_id, cc_interface->device_name, monitor->id, monitor->parent_id); return monitor; } @@ -2453,7 +2453,7 @@ static struct ast_cc_agent *cc_agent_init(struct ast_channel *caller_chan, cc_unref(agent, "Agent init callback failed."); return NULL; } - ast_log_dynamic_level(cc_logger_level, "Core %d: Created an agent for caller %s\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: Created an agent for caller %s\n", agent->core_id, agent->device_name); return agent; } @@ -2558,7 +2558,7 @@ static int offer_timer_expire(const void *data) { struct ast_cc_agent *agent = (struct ast_cc_agent *) data; struct cc_generic_agent_pvt *agent_pvt = agent->private_data; - ast_log_dynamic_level(cc_logger_level, "Core %d: Queuing change request because offer timer has expired.\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: Queuing change request because offer timer has expired.\n", agent->core_id); agent_pvt->offer_timer_id = -1; ast_cc_failed(agent->core_id, "Generic agent %s offer timer expired", agent->device_name); @@ -2576,7 +2576,7 @@ static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent) ast_assert(agent->cc_params != NULL); when = ast_get_cc_offer_timer(agent->cc_params) * 1000; - ast_log_dynamic_level(cc_logger_level, "Core %d: About to schedule offer timer expiration for %d ms\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: About to schedule offer timer expiration for %d ms\n", agent->core_id, when); if ((sched_id = ast_sched_add(cc_sched_context, when, offer_timer_expire, cc_ref(agent, "Give scheduler an agent ref"))) == -1) { return -1; @@ -2702,7 +2702,7 @@ static void *generic_recall(void *data) if (!(chan = ast_request_and_dial(tech, tmp_cap, NULL, target, recall_timer, &reason, generic_pvt->cid_num, generic_pvt->cid_name))) { /* Hmm, no channel. Sucks for you, bud. */ - ast_log_dynamic_level(cc_logger_level, "Core %d: Failed to call back %s for reason %d\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: Failed to call back %s for reason %d\n", agent->core_id, agent->device_name, reason); ast_cc_failed(agent->core_id, "Failed to call back device %s/%s", tech, target); ast_format_cap_destroy(tmp_cap); @@ -2726,7 +2726,7 @@ static void *generic_recall(void *data) pbx_builtin_setvar_helper(chan, "CC_CONTEXT", generic_pvt->context); if (!ast_strlen_zero(callback_macro)) { - ast_log_dynamic_level(cc_logger_level, "Core %d: There's a callback macro configured for agent %s\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: There's a callback macro configured for agent %s\n", agent->core_id, agent->device_name); if (ast_app_exec_macro(NULL, chan, callback_macro)) { ast_cc_failed(agent->core_id, "Callback macro to %s failed. Maybe a hangup?", agent->device_name); @@ -2736,7 +2736,7 @@ static void *generic_recall(void *data) } if (!ast_strlen_zero(callback_sub)) { - ast_log_dynamic_level(cc_logger_level, "Core %d: There's a callback subroutine configured for agent %s\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: There's a callback subroutine configured for agent %s\n", agent->core_id, agent->device_name); if (ast_app_exec_sub(NULL, chan, callback_sub, 0)) { ast_cc_failed(agent->core_id, "Callback subroutine to %s failed. Maybe a hangup?", agent->device_name); @@ -2865,7 +2865,7 @@ static int is_state_change_valid(enum cc_state current_state, const enum cc_stat int is_valid = 0; switch (new_state) { case CC_AVAILABLE: - ast_log_dynamic_level(cc_logger_level, "Core %d: Asked to change to state %d? That should never happen.\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: Asked to change to state %u? That should never happen.\n", agent->core_id, new_state); break; case CC_CALLER_OFFERED: @@ -2908,7 +2908,7 @@ static int is_state_change_valid(enum cc_state current_state, const enum cc_stat is_valid = 1; break; default: - ast_log_dynamic_level(cc_logger_level, "Core %d: Asked to change to unknown state %d\n", + ast_log_dynamic_level(cc_logger_level, "Core %u: Asked to change to unknown state %u\n", agent->core_id, new_state); break; } @@ -3178,7 +3178,7 @@ static int cc_do_state_change(void *datap) enum cc_state previous_state; int res; - ast_log_dynamic_level(cc_logger_level, "Core %d: State change to %d requested. Reason: %s\n", + ast_log_dynamic_level(cc_logger_level, "Core %d: State change to %u requested. Reason: %s\n", args->core_id, args->state, args->debug); core_instance = args->core_instance; diff --git a/main/cel.c b/main/cel.c index f540ac8672..83a1b16216 100644 --- a/main/cel.c +++ b/main/cel.c @@ -417,7 +417,7 @@ const char *ast_cel_get_type_name(enum ast_cel_event_type type) const char *ast_cel_get_ama_flag_name(enum ast_cel_ama_flag flag) { if (flag < 0 || flag >= ARRAY_LEN(cel_ama_flags)) { - ast_log(LOG_WARNING, "Invalid AMA flag: %d\n", flag); + ast_log(LOG_WARNING, "Invalid AMA flag: %u\n", flag); return "Unknown"; } diff --git a/main/channel.c b/main/channel.c index 9b927300cb..d450f415b3 100644 --- a/main/channel.c +++ b/main/channel.c @@ -846,7 +846,7 @@ const char *ast_state2str(enum ast_channel_state state) default: if (!(buf = ast_threadstorage_get(&state2str_threadbuf, STATE2STR_BUFSIZE))) return "Unknown"; - snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%d)", state); + snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%u)", state); return buf; } } @@ -1334,7 +1334,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in if (ast_channel_alert_writable(chan)) { if (ast_channel_alert_write(chan)) { - ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %d): %s!\n", + ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %u): %s!\n", ast_channel_name(chan), queued_frames, strerror(errno)); } } else if (ast_channel_timingfd(chan) > -1) { @@ -2981,7 +2981,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) break; } if (ms == 0) { - ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", ast_channel_name(chan), MAX(delay, 500)); + ast_debug(2, "Didn't receive a media frame from %s within %u ms of answering. Continuing anyway\n", ast_channel_name(chan), MAX(delay, 500)); break; } cur = ast_read(chan); @@ -4188,7 +4188,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) f->len = option_dtmfminduration; } if (f->len < option_dtmfminduration && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)) { - ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, option_dtmfminduration, ast_channel_name(chan)); + ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %u, emulating on %s\n", f->subclass.integer, f->len, option_dtmfminduration, ast_channel_name(chan)); ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF); ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer); ast_channel_emulate_dtmf_duration_set(chan, option_dtmfminduration - f->len); @@ -4664,14 +4664,14 @@ int ast_indicate_data(struct ast_channel *chan, int _condition, if (ts) { /* We have a tone to play, yay. */ - ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", ast_channel_name(chan), condition); + ast_debug(1, "Driver for channel '%s' does not support indication %u, emulating it\n", ast_channel_name(chan), condition); res = ast_playtones_start(chan, 0, ts->data, 1); ts = ast_tone_zone_sound_unref(ts); } if (res) { /* not handled */ - ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, ast_channel_name(chan)); + ast_log(LOG_WARNING, "Unable to handle indication %u for '%s'\n", condition, ast_channel_name(chan)); } indicate_cleanup: @@ -6957,7 +6957,7 @@ int ast_do_masquerade(struct ast_channel *original) /* Start the masquerade channel contents rearangement. */ ast_channel_lock_both(original, clonechan); - ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n", + ast_debug(4, "Actually Masquerading %s(%u) into the structure of %s(%u)\n", ast_channel_name(clonechan), ast_channel_state(clonechan), ast_channel_name(original), ast_channel_state(original)); chans[0] = clonechan; @@ -7294,7 +7294,7 @@ int ast_do_masquerade(struct ast_channel *original) pthread_kill(ast_channel_blocker(original), SIGURG); } - ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original)); + ast_debug(1, "Done Masquerading %s (%u)\n", ast_channel_name(original), ast_channel_state(original)); if ((bridged = ast_bridged_channel(original))) { ast_channel_ref(bridged); @@ -7454,7 +7454,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state) ***/ ast_manager_event(chan, EVENT_FLAG_CALL, "Newstate", "Channel: %s\r\n" - "ChannelState: %d\r\n" + "ChannelState: %u\r\n" "ChannelStateDesc: %s\r\n" "CallerIDNum: %s\r\n" "CallerIDName: %s\r\n" diff --git a/main/cli.c b/main/cli.c index ef5300e411..1fed5282e4 100644 --- a/main/cli.c +++ b/main/cli.c @@ -513,7 +513,7 @@ static char *handle_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args ast_clear_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE); } AST_RWLIST_UNLOCK(&debug_modules); - ast_cli(a->fd, "Core debug was %d and has been set to 0 for '%s'.\n", + ast_cli(a->fd, "Core debug was %u and has been set to 0 for '%s'.\n", ml->level, mod); ast_free(ml); return CLI_SUCCESS; @@ -521,7 +521,7 @@ static char *handle_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args if (ml) { if ((atleast && newlevel < ml->level) || ml->level == newlevel) { - ast_cli(a->fd, "Core debug is still %d for '%s'.\n", ml->level, mod); + ast_cli(a->fd, "Core debug is still %u for '%s'.\n", ml->level, mod); AST_RWLIST_UNLOCK(&debug_modules); return CLI_SUCCESS; } @@ -540,7 +540,7 @@ static char *handle_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args } ast_set_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE); - ast_cli(a->fd, "Core debug was %d and has been set to %d for '%s'.\n", + ast_cli(a->fd, "Core debug was %d and has been set to %u for '%s'.\n", oldval, ml->level, ml->module); AST_RWLIST_UNLOCK(&debug_modules); @@ -1571,7 +1571,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar "Eff. Connected Line ID Name: %s\n" " DNID Digits: %s\n" " Language: %s\n" - " State: %s (%d)\n" + " State: %s (%u)\n" " Rings: %d\n" " NativeFormats: %s\n" " WriteFormat: %s\n" @@ -1579,8 +1579,8 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar " WriteTranscode: %s %s\n" " ReadTranscode: %s %s\n" "1st File Descriptor: %d\n" - " Frames in: %d%s\n" - " Frames out: %d%s\n" + " Frames in: %u%s\n" + " Frames out: %u%s\n" " Time to Hangup: %ld\n" " Elapsed Time: %s\n" " Direct Bridge: %s\n" diff --git a/main/config.c b/main/config.c index 0769b80d1c..ca7d566884 100644 --- a/main/config.c +++ b/main/config.c @@ -2877,7 +2877,7 @@ char *ast_realtime_decode_chunk(char *chunk) char *orig = chunk; for (; *chunk; chunk++) { if (*chunk == '^' && strchr("0123456789ABCDEFabcdef", chunk[1]) && strchr("0123456789ABCDEFabcdef", chunk[2])) { - sscanf(chunk + 1, "%02hhX", chunk); + sscanf(chunk + 1, "%02hhX", (unsigned char *)chunk); memmove(chunk + 1, chunk + 3, strlen(chunk + 3) + 1); } } diff --git a/main/config_options.c b/main/config_options.c index 3cc71711e4..2e6e824934 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -231,7 +231,7 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc if (!opt->handler && !(opt->handler = ast_config_option_default_handler(opt->type))) { /* This should never happen */ - ast_log(LOG_ERROR, "No handler provided, and no default handler exists for type %d\n", opt->type); + ast_log(LOG_ERROR, "No handler provided, and no default handler exists for type %u\n", opt->type); ao2_ref(opt, -1); return -1; }; @@ -779,10 +779,10 @@ static int uint_handler_fn(const struct aco_option *opt, struct ast_variable *va ast_parse_arg(var->value, flags, field, (unsigned int) opt->args[1], (unsigned int) opt->args[2]); if (res) { if (opt->flags & PARSE_RANGE_DEFAULTS) { - ast_log(LOG_WARNING, "Failed to set %s=%s. Set to %d instead due to range limit (%d, %d)\n", var->name, var->value, *field, (int) opt->args[1], (int) opt->args[2]); + ast_log(LOG_WARNING, "Failed to set %s=%s. Set to %u instead due to range limit (%d, %d)\n", var->name, var->value, *field, (int) opt->args[1], (int) opt->args[2]); res = 0; } else if (opt->flags & PARSE_DEFAULT) { - ast_log(LOG_WARNING, "Failed to set %s=%s, Set to default value %d instead.\n", var->name, var->value, *field); + ast_log(LOG_WARNING, "Failed to set %s=%s, Set to default value %u instead.\n", var->name, var->value, *field); res = 0; } } diff --git a/main/data.c b/main/data.c index de7b7b6ec9..e17b80a4b8 100644 --- a/main/data.c +++ b/main/data.c @@ -2115,17 +2115,17 @@ static void data_get_xml_add_child(struct ast_data *parent_data, ast_xml_set_text(child_xml, node->payload.str); break; case AST_DATA_TIMESTAMP: - snprintf(node_content, sizeof(node_content), "%d", + snprintf(node_content, sizeof(node_content), "%u", node->payload.uint); ast_xml_set_text(child_xml, node_content); break; case AST_DATA_SECONDS: - snprintf(node_content, sizeof(node_content), "%d", + snprintf(node_content, sizeof(node_content), "%u", node->payload.uint); ast_xml_set_text(child_xml, node_content); break; case AST_DATA_MILLISECONDS: - snprintf(node_content, sizeof(node_content), "%d", + snprintf(node_content, sizeof(node_content), "%u", node->payload.uint); ast_xml_set_text(child_xml, node_content); break; @@ -2754,17 +2754,17 @@ static void data_result_print_cli_node(int fd, const struct ast_data *node, uint node->name); break; case AST_DATA_TIMESTAMP: - ast_str_append(&output, 0, "%s%s: %d\n", ast_str_buffer(tabs), + ast_str_append(&output, 0, "%s%s: %u\n", ast_str_buffer(tabs), node->name, node->payload.uint); break; case AST_DATA_SECONDS: - ast_str_append(&output, 0, "%s%s: %d\n", ast_str_buffer(tabs), + ast_str_append(&output, 0, "%s%s: %u\n", ast_str_buffer(tabs), node->name, node->payload.uint); break; case AST_DATA_MILLISECONDS: - ast_str_append(&output, 0, "%s%s: %d\n", ast_str_buffer(tabs), + ast_str_append(&output, 0, "%s%s: %u\n", ast_str_buffer(tabs), node->name, node->payload.uint); break; @@ -2815,6 +2815,7 @@ static void data_result_print_cli_node(int fd, const struct ast_data *node, uint * \param[in] root The root node of the tree. * \param[in] depth Actual depth. */ + static void __data_result_print_cli(int fd, const struct ast_data *root, uint32_t depth) { struct ao2_iterator iter; diff --git a/main/devicestate.c b/main/devicestate.c index d114d02abb..0833e27ac1 100644 --- a/main/devicestate.c +++ b/main/devicestate.c @@ -439,7 +439,7 @@ static void devstate_event(const char *device, enum ast_device_state state, int event_type = AST_EVENT_DEVICE_STATE; } - ast_debug(3, "device '%s' state '%d'\n", device, state); + ast_debug(3, "device '%s' state '%u'\n", device, state); if (!(event = ast_event_new(event_type, AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, device, @@ -464,7 +464,7 @@ static void do_state_change(const char *device, int cachable) state = _ast_device_state(device, 0); - ast_debug(3, "Changing state for %s - state %d (%s)\n", device, state, ast_devstate2str(state)); + ast_debug(3, "Changing state for %s - state %u (%s)\n", device, state, ast_devstate2str(state)); devstate_event(device, state, cachable); } diff --git a/main/dsp.c b/main/dsp.c index ec5e09b7dc..d00b333f5a 100644 --- a/main/dsp.c +++ b/main/dsp.c @@ -1099,7 +1099,7 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len) } break; default: - ast_log(LOG_WARNING, "Can't process in unknown prog mode '%d'\n", dsp->progmode); + ast_log(LOG_WARNING, "Can't process in unknown prog mode '%u'\n", dsp->progmode); } if (newstate == dsp->tstate) { dsp->tcount++; diff --git a/main/enum.c b/main/enum.c index 0dead9aa5b..4c6dbcce47 100644 --- a/main/enum.c +++ b/main/enum.c @@ -376,7 +376,7 @@ static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char srclen--; if (len > srclen) { - ast_log(LOG_WARNING, "ENUM parsing failed: Wanted %d characters, got %d\n", len, srclen); + ast_log(LOG_WARNING, "ENUM parsing failed: Wanted %u characters, got %u\n", len, srclen); return -1; } @@ -654,7 +654,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds return -1; } - ast_debug(2, "num='%s', tech='%s', suffix='%s', options='%s', record=%d\n", number, tech, suffix, options, record); + ast_debug(2, "num='%s', tech='%s', suffix='%s', options='%s', record=%u\n", number, tech, suffix, options, record); /* We don't need that any more, that "n" preceding the number has been replaced by a flag diff --git a/main/event.c b/main/event.c index 0904f8b615..317a151bea 100644 --- a/main/event.c +++ b/main/event.c @@ -296,7 +296,7 @@ const char *ast_event_get_type_name(const struct ast_event *event) type = ast_event_get_type(event); if (type < 0 || type >= ARRAY_LEN(event_names)) { - ast_log(LOG_ERROR, "Invalid event type - '%d'\n", type); + ast_log(LOG_ERROR, "Invalid event type - '%u'\n", type); return ""; } @@ -1232,7 +1232,7 @@ struct ast_event *ast_event_new(enum ast_event_type type, ...) /* Invalid type */ if (type >= AST_EVENT_TOTAL) { ast_log(LOG_WARNING, "Someone tried to create an event of invalid " - "type '%d'!\n", type); + "type '%u'!\n", type); return NULL; } diff --git a/main/features.c b/main/features.c index d21d92d78c..6a044d9d2f 100644 --- a/main/features.c +++ b/main/features.c @@ -2948,7 +2948,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st if (atxferloopdelay) { /* Transfer failed, sleeping */ - ast_debug(1, "Sleeping for %d ms before retrying atxfer.\n", + ast_debug(1, "Sleeping for %u ms before retrying atxfer.\n", atxferloopdelay); ast_safe_sleep(transferee, atxferloopdelay); if (ast_check_hangup(transferee)) { @@ -3737,7 +3737,7 @@ static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, snprintf(dynamic_features_buf, sizeof(dynamic_features_buf), "%s%s%s", S_OR(chan_dynamic_features, ""), chan_dynamic_features && peer_dynamic_features ? "#" : "", S_OR(peer_dynamic_features,"")); - ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", ast_channel_name(chan), ast_channel_name(peer), code, sense, features.flags, dynamic_features_buf); + ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%u, dynamic=%s\n", ast_channel_name(chan), ast_channel_name(peer), code, sense, features.flags, dynamic_features_buf); return feature_interpret_helper(chan, peer, config, code, sense, dynamic_features_buf, &features, FEATURE_INTERPRET_DO, &feature); } @@ -4165,7 +4165,7 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i ast_log(LOG_NOTICE, "CHAN: name: %s; appl: %s; data: %s; contxt: %s; exten: %s; pri: %d;\n", ast_channel_name(chan), ast_channel_appl(chan), ast_channel_data(chan), ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); ast_log(LOG_NOTICE, "CHAN: acctcode: %s; dialcontext: %s; amaflags: %x; maccontxt: %s; macexten: %s; macpri: %d;\n", - ast_channel_accountcode(chan), ast_channel_dialcontext(chan), ast_channel_amaflags(chan), ast_channel_macrocontext(chan), ast_channel_macroexten(chan), ast_channel_macropriority(chan)); + ast_channel_accountcode(chan), ast_channel_dialcontext(chan), (unsigned)ast_channel_amaflags(chan), ast_channel_macrocontext(chan), ast_channel_macroexten(chan), ast_channel_macropriority(chan)); ast_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n", ast_channel_masq(chan), ast_channel_masqr(chan), ast_channel_internal_bridged_channel(chan), ast_channel_uniqueid(chan), ast_channel_linkedid(chan)); @@ -5493,7 +5493,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) struct ast_context *con; char *parse; const char *pl_name; - int park = 0; + unsigned int park = 0; struct ast_bridge_config config; struct ast_parkinglot *parkinglot; AST_DECLARE_APP_ARGS(app_args, @@ -5702,7 +5702,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) } /* This runs sorta backwards, since we give the incoming channel control, as if it were the person called. */ - ast_verb(3, "Channel %s connected to parked call %d\n", ast_channel_name(chan), park); + ast_verb(3, "Channel %s connected to parked call %u\n", ast_channel_name(chan), park); pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", ast_channel_name(peer)); ast_cdr_setdestchan(ast_channel_cdr(chan), ast_channel_name(peer)); @@ -5754,7 +5754,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", "pbx-invalidpark", ast_channel_name(chan)); } - ast_verb(3, "Channel %s tried to retrieve nonexistent parked call %d\n", + ast_verb(3, "Channel %s tried to retrieve nonexistent parked call %u\n", ast_channel_name(chan), park); res = -1; } @@ -7225,7 +7225,7 @@ static char *handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cl ast_cli(a->fd,"%-22s: %s%s\n", "Comeback context", curlot->cfg.comebackcontext, (curlot->cfg.comebacktoorigin ? " (comebacktoorigin=yes, not used)" : "")); - ast_cli(a->fd,"%-22s: %d\n", "Comeback dial time", + ast_cli(a->fd,"%-22s: %u\n", "Comeback dial time", curlot->cfg.comebackdialtime); ast_cli(a->fd,"%-22s: %s\n", "MusicOnHold class", curlot->cfg.mohclass); ast_cli(a->fd,"%-22s: %s\n", "Enabled", AST_CLI_YESNO(!curlot->disabled)); @@ -7562,7 +7562,7 @@ static int manager_parkinglot_list(struct mansession *s, const struct message *m "Name: %s\r\n" "StartExten: %d\r\n" "StopExten: %d\r\n" - "Timeout: %d\r\n" + "Timeout: %u\r\n" "\r\n", curlot->name, curlot->cfg.parking_start, diff --git a/main/file.c b/main/file.c index 12ec4f1d95..d491694158 100644 --- a/main/file.c +++ b/main/file.c @@ -549,7 +549,7 @@ static int filehelper(const char *filename, const void *arg2, const char *fmt, c break; default: - ast_log(LOG_WARNING, "Unknown helper %d\n", action); + ast_log(LOG_WARNING, "Unknown helper %u\n", action); } ast_free(fn); } diff --git a/main/format.c b/main/format.c index adf4151c9f..a5ecaba1b6 100644 --- a/main/format.c +++ b/main/format.c @@ -897,7 +897,7 @@ static char *show_codec_n(struct ast_cli_entry *e, int cmd, struct ast_cli_args } if (!found) { - ast_cli(a->fd, "Codec %d not found\n", format_id); + ast_cli(a->fd, "Codec %u not found\n", format_id); } f_list = ast_format_list_destroy(f_list); @@ -1142,7 +1142,7 @@ static int custom_celt_format(struct ast_format_list *entry, unsigned int maxbit return -1; } - snprintf(entry->desc, sizeof(entry->desc), "CELT Custom Format %dkhz", entry->samplespersecond/1000); + snprintf(entry->desc, sizeof(entry->desc), "CELT Custom Format %ukhz", entry->samplespersecond/1000); ast_format_append(&entry->format, CELT_ATTR_KEY_SAMP_RATE, entry->samplespersecond, @@ -1195,7 +1195,7 @@ static int custom_silk_format(struct ast_format_list *entry, unsigned int maxbit AST_FORMAT_ATTR_END); break; default: - ast_log(LOG_WARNING, "Custom SILK format definition '%s' can not support sample rate %d\n", entry->name, entry->samplespersecond); + ast_log(LOG_WARNING, "Custom SILK format definition '%s' can not support sample rate %u\n", entry->name, entry->samplespersecond); return -1; } ast_format_append(&entry->format, @@ -1364,7 +1364,7 @@ int ast_format_attr_reg_interface(const struct ast_format_attr_interface *interf /* check for duplicates first*/ if ((wrapper = ao2_find(interfaces, &tmp_wrapper, (OBJ_POINTER | OBJ_NOLOCK)))) { ao2_unlock(interfaces); - ast_log(LOG_WARNING, "Can not register attribute interface for format id %d, interface already exists.\n", interface->id); + ast_log(LOG_WARNING, "Can not register attribute interface for format id %u, interface already exists.\n", interface->id); ao2_ref(wrapper, -1); return -1; } diff --git a/main/frame.c b/main/frame.c index ddc74a183d..9c4d744d68 100644 --- a/main/frame.c +++ b/main/frame.c @@ -733,7 +733,7 @@ void ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len) ast_copy_string(ftype, "Video", len); break; default: - snprintf(ftype, len, "Unknown Frametype '%d'", frame_type); + snprintf(ftype, len, "Unknown Frametype '%u'", frame_type); } } @@ -773,7 +773,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) ast_frame_subclass2str(f, subclass, sizeof(subclass), moreinfo, sizeof(moreinfo)); if (!ast_strlen_zero(moreinfo)) - ast_verb(-1, "%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s]\n", + ast_verb(-1, "%s [ TYPE: %s (%u) SUBCLASS: %s (%d) '%s' ] [%s]\n", term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)), term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)), f->frametype, @@ -782,7 +782,7 @@ void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix) term_color(cmn, moreinfo, COLOR_BRGREEN, COLOR_BLACK, sizeof(cmn)), term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn))); else - ast_verb(-1, "%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s]\n", + ast_verb(-1, "%s [ TYPE: %s (%u) SUBCLASS: %s (%d) ] [%s]\n", term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)), term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)), f->frametype, @@ -873,7 +873,7 @@ static int g723_len(unsigned char buf) return 20; break; default: - ast_log(LOG_WARNING, "Badly encoded frame (%d)\n", type); + ast_log(LOG_WARNING, "Badly encoded frame (%u)\n", type); } return -1; } diff --git a/main/io.c b/main/io.c index cd15b5b077..cd35995ad3 100644 --- a/main/io.c +++ b/main/io.c @@ -312,7 +312,7 @@ void ast_io_dump(struct io_context *ioc) */ int x; - ast_debug(1, "Asterisk IO Dump: %d entries, %d max entries\n", ioc->fdcnt, ioc->maxfdcnt); + ast_debug(1, "Asterisk IO Dump: %u entries, %u max entries\n", ioc->fdcnt, ioc->maxfdcnt); ast_debug(1, "================================================\n"); ast_debug(1, "| ID FD Callback Data Events |\n"); ast_debug(1, "+------+------+-----------+-----------+--------+\n"); @@ -322,7 +322,7 @@ void ast_io_dump(struct io_context *ioc) ioc->fds[x].fd, ioc->ior[x].callback, ioc->ior[x].data, - ioc->fds[x].events); + (unsigned)ioc->fds[x].events); } ast_debug(1, "================================================\n"); } diff --git a/main/loader.c b/main/loader.c index 314d7dd0b0..67022ec775 100644 --- a/main/loader.c +++ b/main/loader.c @@ -304,7 +304,7 @@ static int printdigest(const unsigned char *d) char buf[256]; /* large enough so we don't have to worry */ for (pos = 0, x = 0; x < 16; x++) - pos += sprintf(buf + pos, " %02x", *d++); + pos += sprintf(buf + pos, " %02x", (unsigned)*d++); ast_debug(1, "Unexpected signature:%s\n", buf); @@ -1205,7 +1205,7 @@ int load_modules(unsigned int preload_only) load_count++; if (load_count) - ast_log(LOG_NOTICE, "%d modules will be loaded.\n", load_count); + ast_log(LOG_NOTICE, "%u modules will be loaded.\n", load_count); /* first, load only modules that provide global symbols */ if ((res = load_resource_list(&load_order, 1, &modulecount)) < 0) { diff --git a/main/logger.c b/main/logger.c index fa74a13baf..8b0babeecd 100644 --- a/main/logger.c +++ b/main/logger.c @@ -243,7 +243,7 @@ static void make_components(struct logchannel *chan) unsigned int logmask = 0; char *stringp = ast_strdupa(chan->components); unsigned int x; - int verb_level; + unsigned int verb_level; /* Default to using option_verbose as the verbosity level of the logging channel. */ verb_level = -1; @@ -1026,7 +1026,7 @@ static void ast_log_vsyslog(struct logmsg *msg) char call_identifier_str[13]; if (msg->callid) { - snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", msg->callid->call_identifier); + snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", (unsigned)msg->callid->call_identifier); } else { call_identifier_str[0] = '\0'; } @@ -1072,7 +1072,7 @@ static void logger_print_normal(struct logmsg *logmsg) char call_identifier_str[13]; if (logmsg->callid) { - snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", logmsg->callid->call_identifier); + snprintf(call_identifier_str, sizeof(call_identifier_str), "[C-%08x]", (unsigned)logmsg->callid->call_identifier); } else { call_identifier_str[0] = '\0'; } @@ -1312,7 +1312,7 @@ void close_logger(void) void ast_callid_strnprint(char *buffer, size_t buffer_size, struct ast_callid *callid) { - snprintf(buffer, buffer_size, "[C-%08x]", callid->call_identifier); + snprintf(buffer, buffer_size, "[C-%08x]", (unsigned)callid->call_identifier); } struct ast_callid *ast_create_callid(void) @@ -2139,7 +2139,7 @@ int ast_logger_register_level(const char *name) AST_RWLIST_UNLOCK(&logchannels); - ast_debug(1, "Registered dynamic logger level '%s' with index %d.\n", name, available); + ast_debug(1, "Registered dynamic logger level '%s' with index %u.\n", name, available); update_logchannels(); @@ -2177,7 +2177,7 @@ void ast_logger_unregister_level(const char *name) levels[x] = NULL; AST_RWLIST_UNLOCK(&logchannels); - ast_debug(1, "Unregistered dynamic logger level '%s' with index %d.\n", name, x); + ast_debug(1, "Unregistered dynamic logger level '%s' with index %u.\n", name, x); update_logchannels(); } else { diff --git a/main/manager.c b/main/manager.c index e26d0743d7..5fd5d7a3a8 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2637,7 +2637,7 @@ static int authenticate(struct mansession *s, const struct message *m) MD5Update(&md5, (unsigned char *) user->secret, strlen(user->secret)); MD5Final(digest, &md5); for (x = 0; x < 16; x++) - len += sprintf(md5key + len, "%2.2x", digest[x]); + len += sprintf(md5key + len, "%2.2x", (unsigned)digest[x]); if (!strcmp(md5key, key)) { error = 0; } else { @@ -3642,7 +3642,7 @@ static int action_status(struct mansession *s, const struct message *m) "ConnectedLineNum: %s\r\n" "ConnectedLineName: %s\r\n" "Accountcode: %s\r\n" - "ChannelState: %d\r\n" + "ChannelState: %u\r\n" "ChannelStateDesc: %s\r\n" "Context: %s\r\n" "Extension: %s\r\n" @@ -5053,7 +5053,7 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m "Context: %s\r\n" "Extension: %s\r\n" "Priority: %d\r\n" - "ChannelState: %d\r\n" + "ChannelState: %u\r\n" "ChannelStateDesc: %s\r\n" "Application: %s\r\n" "ApplicationData: %s\r\n" diff --git a/main/netsock.c b/main/netsock.c index 598bc4b705..8052db862e 100644 --- a/main/netsock.c +++ b/main/netsock.c @@ -215,10 +215,10 @@ char *ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid) *s = '\0'; } else { for (x = 0; x < 5; x++) { - sprintf(s, "%02x:", eid->eid[x]); + sprintf(s, "%02x:", (unsigned)eid->eid[x]); s += 3; } - sprintf(s, "%02x", eid->eid[5]); + sprintf(s, "%02x", (unsigned)eid->eid[5]); } return os; } @@ -250,7 +250,7 @@ void ast_set_default_eid(struct ast_eid *eid) /* Try pciX#[1..N] */ for (i = 0; i < MAXIF; i++) { memset(&ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "pci%u#%u", x, i); + snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "pci%d#%u", x, i); if (!ioctl(s, SIOCGIFHWADDR, &ifr)) { break; } diff --git a/main/pbx.c b/main/pbx.c index 72d305b4bb..a8b58de165 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3619,7 +3619,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru } if (s == ¬_found) { /* look for more */ if (!strcmp(var, "EPOCH")) { - ast_str_set(str, maxlen, "%u", (int) time(NULL)); + ast_str_set(str, maxlen, "%d", (int) time(NULL)); s = ast_str_buffer(*str); } else if (!strcmp(var, "SYSTEMNAME")) { s = ast_config_AST_SYSTEM_NAME; diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 217b704c83..6b1056ca31 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -1864,7 +1864,7 @@ char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_r /* Now actually fill the buffer with the good information */ if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY) { - snprintf(buf, size, "ssrc=%i;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", + snprintf(buf, size, "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", stats.local_ssrc, stats.remote_ssrc, stats.rxploss, stats.rxjitter, stats.rxcount, stats.txjitter, stats.txcount, stats.txploss, stats.rtt); } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER) { snprintf(buf, size, "minrxjitter=%f;maxrxjitter=%f;avgrxjitter=%f;stdevrxjitter=%f;reported_minjitter=%f;reported_maxjitter=%f;reported_avgjitter=%f;reported_stdevjitter=%f;", diff --git a/main/sched.c b/main/sched.c index fa809e1722..a67f2f826d 100644 --- a/main/sched.c +++ b/main/sched.c @@ -506,7 +506,7 @@ void ast_sched_report(struct ast_sched_context *con, struct ast_str **buf, struc size_t heap_size; memset(countlist, 0, sizeof(countlist)); - ast_str_set(buf, 0, " Highwater = %d\n schedcnt = %d\n", con->highwater, con->schedcnt); + ast_str_set(buf, 0, " Highwater = %u\n schedcnt = %u\n", con->highwater, con->schedcnt); ast_mutex_lock(&con->lock); @@ -543,9 +543,9 @@ void ast_sched_dump(struct ast_sched_context *con) int x; size_t heap_size; #ifdef SCHED_MAX_CACHE - ast_debug(1, "Asterisk Schedule Dump (%d in Q, %d Total, %d Cache, %d high-water)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt, con->highwater); + ast_debug(1, "Asterisk Schedule Dump (%u in Q, %u Total, %u Cache, %u high-water)\n", con->schedcnt, con->eventcnt - 1, con->schedccnt, con->highwater); #else - ast_debug(1, "Asterisk Schedule Dump (%d in Q, %d Total, %d high-water)\n", con->schedcnt, con->eventcnt - 1, con->highwater); + ast_debug(1, "Asterisk Schedule Dump (%u in Q, %u Total, %u high-water)\n", con->schedcnt, con->eventcnt - 1, con->highwater); #endif ast_debug(1, "=============================================================\n"); diff --git a/main/security_events.c b/main/security_events.c index 40db093854..6d4d9776cf 100644 --- a/main/security_events.c +++ b/main/security_events.c @@ -564,7 +564,7 @@ static int add_ie(struct ast_event **event, const struct ast_security_event_comm if (req && !str) { ast_log(LOG_WARNING, "Required IE '%d' for security event " - "type '%d' not present\n", ie_type->ie_type, + "type '%u' not present\n", ie_type->ie_type, sec->event_type); res = -1; } @@ -593,7 +593,7 @@ static int add_ie(struct ast_event **event, const struct ast_security_event_comm if (req && !addr->addr) { ast_log(LOG_WARNING, "Required IE '%d' for security event " - "type '%d' not present\n", ie_type->ie_type, + "type '%u' not present\n", ie_type->ie_type, sec->event_type); res = -1; } @@ -611,7 +611,7 @@ static int add_ie(struct ast_event **event, const struct ast_security_event_comm if (req && !tval) { ast_log(LOG_WARNING, "Required IE '%d' for security event " - "type '%d' not present\n", ie_type->ie_type, + "type '%u' not present\n", ie_type->ie_type, sec->event_type); res = -1; } diff --git a/main/slinfactory.c b/main/slinfactory.c index 687a6c02db..44efc420f3 100644 --- a/main/slinfactory.c +++ b/main/slinfactory.c @@ -91,7 +91,7 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f) if (!sf->trans) { if (!(sf->trans = ast_translator_build_path(&sf->output_format, &f->subclass.format))) { - ast_log(LOG_WARNING, "Cannot build a path from %s (%d)to %s (%d)\n", + ast_log(LOG_WARNING, "Cannot build a path from %s (%u)to %s (%u)\n", ast_getformatname(&f->subclass.format), f->subclass.format.id, ast_getformatname(&sf->output_format), diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c index f7b4bd0050..1cee71d23d 100644 --- a/main/stdtime/localtime.c +++ b/main/stdtime/localtime.c @@ -309,7 +309,7 @@ static void *inotify_daemon(void *data) /* This read should block, most of the time. */ if ((res = read(inotify_fd, &buf, sizeof(buf))) < sizeof(buf.iev) && res > 0) { /* This should never happen */ - ast_log(LOG_ERROR, "Inotify read less than a full event (%zd < %zd)?!!\n", res, sizeof(buf.iev)); + ast_log(LOG_ERROR, "Inotify read less than a full event (%zd < %zu)?!!\n", res, sizeof(buf.iev)); break; } else if (res < 0) { if (errno == EINTR || errno == EAGAIN) { diff --git a/main/stun.c b/main/stun.c index 3b4d2ad6b1..268bbe4dec 100644 --- a/main/stun.c +++ b/main/stun.c @@ -182,7 +182,7 @@ static int stun_process_attr(struct stun_state *state, struct stun_attr *attr) { if (stundebug) ast_verbose("Found STUN Attribute %s (%04x), length %d\n", - stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr), ntohs(attr->len)); + stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr), ntohs(attr->len)); switch (ntohs(attr->attr)) { case STUN_USERNAME: state->username = (const char *) (attr->value); @@ -193,7 +193,7 @@ static int stun_process_attr(struct stun_state *state, struct stun_attr *attr) default: if (stundebug) ast_verbose("Ignoring STUN attribute %s (%04x), length %d\n", - stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr), ntohs(attr->len)); + stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr), ntohs(attr->len)); } return 0; } @@ -281,7 +281,7 @@ int ast_stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, data += sizeof(struct stun_header); x = ntohs(hdr->msglen); /* len as advertised in the message */ if (stundebug) - ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), ntohs(hdr->msgtype), x); + ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), (unsigned)ntohs(hdr->msgtype), x); if (x > len) { ast_debug(1, "Scrambled STUN packet length (got %d, expecting %d)\n", x, (int)len); } else @@ -302,7 +302,7 @@ int ast_stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, if (stun_cb) stun_cb(attr, arg); if (stun_process_attr(&st, attr)) { - ast_debug(1, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), ntohs(attr->attr)); + ast_debug(1, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr)); break; } /* Clear attribute id: in case previous entry was a string, @@ -353,7 +353,7 @@ int ast_stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, break; default: if (stundebug) - ast_verbose("Dunno what to do with STUN message %04x (%s)\n", ntohs(hdr->msgtype), stun_msg2str(ntohs(hdr->msgtype))); + ast_verbose("Dunno what to do with STUN message %04x (%s)\n", (unsigned)ntohs(hdr->msgtype), stun_msg2str(ntohs(hdr->msgtype))); } } return ret; diff --git a/main/taskprocessor.c b/main/taskprocessor.c index d8f1af3e84..ad2e15c3ca 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -282,7 +282,7 @@ static char *cli_tps_report(struct ast_cli_entry *e, int cmd, struct ast_cli_arg qsize = p->tps_queue_size; maxqsize = p->stats->max_qsize; processed = p->stats->_tasks_processed_count; - ast_cli(a->fd, "\n%24s %17ld %12ld %12ld", name, processed, qsize, maxqsize); + ast_cli(a->fd, "\n%24s %17lu %12lu %12lu", name, processed, qsize, maxqsize); ao2_ref(p, -1); } ao2_iterator_destroy(&i); diff --git a/main/translate.c b/main/translate.c index 84e24e56fb..c14ad019c3 100644 --- a/main/translate.c +++ b/main/translate.c @@ -536,7 +536,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f, frame. */ path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(&out->subclass.format))); if (f->samples != out->samples && ast_test_flag(out, AST_FRFLAG_HAS_TIMING_INFO)) { - ast_debug(4, "Sample size different %u vs %u\n", f->samples, out->samples); + ast_debug(4, "Sample size different %d vs %d\n", f->samples, out->samples); ast_clear_flag(out, AST_FRFLAG_HAS_TIMING_INFO); } } else { @@ -773,7 +773,7 @@ static void matrix_rebuild(int samples) matrix_get(x, z)->table_cost = newtablecost; matrix_get(x, z)->multistep = 1; changed++; - ast_debug(10, "Discovered %d cost path from %s to %s, via %s\n", + ast_debug(10, "Discovered %u cost path from %s to %s, via %s\n", matrix_get(x, z)->table_cost, ast_getformatname(ast_format_set(&tmpx, index2format(x), 0)), ast_getformatname(ast_format_set(&tmpy, index2format(z), 0)), @@ -913,7 +913,7 @@ static char *handle_show_translation_table(struct ast_cli_args *a) if (x >= 0 && y >= 0 && matrix_get(x, y)->step) { /* Actual codec output */ - ast_str_append(&out, 0, "%*d", curlen + 1, (matrix_get(x, y)->table_cost/100)); + ast_str_append(&out, 0, "%*u", curlen + 1, (matrix_get(x, y)->table_cost/100)); } else if (i == -1 && k >= 0) { /* Top row - use a dynamic size */ ast_str_append(&out, 0, "%*s", curlen + 1, ast_getformatname(&f_list[k].format)); diff --git a/main/udptl.c b/main/udptl.c index b5d1394345..fdc636299e 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -323,7 +323,7 @@ static int encode_open_type(const struct ast_udptl *udptl, uint8_t *buf, unsigne if ((enclen = encode_length(buf, len, num_octets)) < 0) return -1; if (enclen + *len > buflen) { - ast_log(LOG_ERROR, "UDPTL (%s): Buffer overflow detected (%d + %d > %d)\n", + ast_log(LOG_ERROR, "UDPTL (%s): Buffer overflow detected (%u + %u > %u)\n", LOG_TAG(udptl), enclen, *len, buflen); return -1; } @@ -401,7 +401,7 @@ static int udptl_rx_packet(struct ast_udptl *s, uint8_t *buf, unsigned int len) if (seq_no - i >= s->rx_seq_no) { /* This one wasn't seen before */ /* Decode the secondary IFP packet */ - ast_debug(3, "Recovering lost packet via secondary %d, len %d\n", seq_no - i, lengths[i - 1]); + ast_debug(3, "Recovering lost packet via secondary %d, len %u\n", seq_no - i, lengths[i - 1]); s->f[ifp_no].frametype = AST_FRAME_MODEM; s->f[ifp_no].subclass.integer = AST_MODEM_T38; @@ -1116,7 +1116,7 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f) if (len > s->far_max_ifp) { ast_log(LOG_WARNING, - "UDPTL (%s): UDPTL asked to send %d bytes of IFP when far end only prepared to accept %d bytes; data loss will occur." + "UDPTL (%s): UDPTL asked to send %u bytes of IFP when far end only prepared to accept %d bytes; data loss will occur." "You may need to override the T38FaxMaxDatagram value for this endpoint in the channel driver configuration.\n", LOG_TAG(s), len, s->far_max_ifp); len = s->far_max_ifp; @@ -1134,7 +1134,7 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f) LOG_TAG(s), ast_sockaddr_stringify(&s->them), strerror(errno)); } if (udptl_debug_test_addr(&s->them)) { - ast_verb(1, "UDPTL (%s): packet to %s (seq %d, len %d)\n", + ast_verb(1, "UDPTL (%s): packet to %s (seq %u, len %u)\n", LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len); } } @@ -1451,7 +1451,7 @@ static int udptl_pre_apply_config(void) { /* Fix up any global config values that we can handle before replacing the config */ if (cfg->general->use_even_ports && (cfg->general->start & 1)) { ++cfg->general->start; - ast_log(LOG_NOTICE, "Odd numbered udptlstart specified but use_even_ports enabled. udptlstart is now %d\n", cfg->general->start); + ast_log(LOG_NOTICE, "Odd numbered udptlstart specified but use_even_ports enabled. udptlstart is now %u\n", cfg->general->start); } if (cfg->general->start > cfg->general->end) { ast_log(LOG_WARNING, "Unreasonable values for UDPTL start/end ports; defaulting to %s-%s.\n", __stringify(DEFAULT_UDPTLSTART), __stringify(DEFAULT_UDPTLEND)); @@ -1460,7 +1460,7 @@ static int udptl_pre_apply_config(void) { } if (cfg->general->use_even_ports && (cfg->general->end & 1)) { --cfg->general->end; - ast_log(LOG_NOTICE, "Odd numbered udptlend specified but use_even_ports enabled. udptlend is now %d\n", cfg->general->end); + ast_log(LOG_NOTICE, "Odd numbered udptlend specified but use_even_ports enabled. udptlend is now %u\n", cfg->general->end); } return 0; diff --git a/main/utils.c b/main/utils.c index ca22da25d8..d5c44ee6c5 100644 --- a/main/utils.c +++ b/main/utils.c @@ -261,7 +261,7 @@ void ast_md5_hash(char *output, const char *input) MD5Final(digest, &md5); ptr = output; for (x = 0; x < 16; x++) - ptr += sprintf(ptr, "%2.2x", digest[x]); + ptr += sprintf(ptr, "%2.2x", (unsigned)digest[x]); } /*! \brief Produce 40 char SHA1 hash of value. */ @@ -279,7 +279,7 @@ void ast_sha1_hash(char *output, const char *input) SHA1Result(&sha, Message_Digest); ptr = output; for (x = 0; x < 20; x++) - ptr += sprintf(ptr, "%2.2x", Message_Digest[x]); + ptr += sprintf(ptr, "%2.2x", (unsigned)Message_Digest[x]); } /*! \brief Produce a 20 byte SHA1 hash of value. */ @@ -430,7 +430,7 @@ char *ast_uri_encode(const char *string, char *outbuf, int buflen, struct ast_fl if (out - outbuf >= buflen - 3) { break; } - out += sprintf(out, "%%%02X", (unsigned char) *ptr); + out += sprintf(out, "%%%02X", (unsigned) *ptr); } else { *out = *ptr; /* Continue copying the string */ out++; diff --git a/main/xmldoc.c b/main/xmldoc.c index cb9e13f1f8..874208e080 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -2410,7 +2410,7 @@ int ast_xmldoc_load_documentation(void) globret = glob(xmlpattern, MY_GLOB_FLAGS, NULL, &globbuf); #endif - ast_debug(3, "gl_pathc %zd\n", globbuf.gl_pathc); + ast_debug(3, "gl_pathc %zu\n", globbuf.gl_pathc); if (globret == GLOB_NOSPACE) { ast_log(LOG_WARNING, "XML load failure, glob expansion of pattern '%s' failed: Not enough memory\n", xmlpattern); ast_free(xmlpattern); diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c index 48f17107f5..ca219fd1e2 100644 --- a/pbx/dundi-parser.c +++ b/pbx/dundi-parser.c @@ -61,7 +61,7 @@ char *dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid) *s = '\0'; } else { for (x=0;x<6;x++) { - sprintf(s, "%02X", eid->eid[x]); + sprintf(s, "%02X", (unsigned)eid->eid[x]); s += 2; } } @@ -320,7 +320,7 @@ static void dump_encrypted(char *output, int maxlen, void *value, int len) if ((len > 16) && !(len % 16)) { /* Build up IV */ for (x=0;x<16;x++) { - snprintf(iv + (x << 1), 3, "%02x", ((unsigned char *)value)[x]); + snprintf(iv + (x << 1), 3, "%02x", (unsigned)((unsigned char *)value)[x]); } snprintf(output, maxlen, "[IV %s] %d encrypted blocks\n", iv, len / 16); } else @@ -334,7 +334,7 @@ static void dump_raw(char *output, int maxlen, void *value, int len) output[maxlen - 1] = '\0'; strcpy(output, "[ "); for (x=0;xcmdresp & 0x3f)]; } - snprintf(subclass2, (int)sizeof(subclass2), "%02x", fhi->cmdflags); + snprintf(subclass2, (int)sizeof(subclass2), "%02x", (unsigned)fhi->cmdflags); subclass = subclass2; snprintf(tmp, (int)sizeof(tmp), "%s-Frame -- OSeqno: %3.3d ISeqno: %3.3d Type: %s (%s)\n", diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index b3cc211b07..478d3ce54a 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -538,7 +538,7 @@ static char *complete_dialplan_remove_extension(struct ast_cli_args *a) /* XXX lock e ? */ priority = NULL; while ( !ret && (priority = ast_walk_extension_priorities(e, priority)) ) { - snprintf(buffer, sizeof(buffer), "%u", ast_get_extension_priority(priority)); + snprintf(buffer, sizeof(buffer), "%d", ast_get_extension_priority(priority)); if (partial_match(buffer, a->word, len) && ++which > a->n) /* n-th match */ ret = strdup(buffer); } diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 9946a7d362..f2bb06cdbd 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -917,7 +917,7 @@ static int cache_save(dundi_eid *eidpeer, struct dundi_request *req, int start, /* Skip anything with an illegal pipe in it */ if (strchr(req->dr[x].dest, '|')) continue; - snprintf(data + strlen(data), sizeof(data) - strlen(data), "%d/%d/%d/%s/%s|", + snprintf(data + strlen(data), sizeof(data) - strlen(data), "%u/%d/%d/%s/%s|", req->dr[x].flags, req->dr[x].weight, req->dr[x].techint, req->dr[x].dest, dundi_eid_to_str_short(eidpeer_str, sizeof(eidpeer_str), &req->dr[x].eid)); } @@ -1176,7 +1176,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke if (expiration > 0) { ast_debug(1, "Found cache expiring in %d seconds!\n", expiration); ptr += length + 1; - while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) { + while((sscanf(ptr, "%30d/%30d/%30d/%n", (int *)&(flags.flags), &weight, &tech, &length) == 3)) { ptr += length; term = strchr(ptr, '|'); if (term) { @@ -1246,7 +1246,7 @@ static int cache_lookup(struct dundi_request *req, dundi_eid *peer_eid, uint32_t ast_eid_to_str(eid_str_full, sizeof(eid_str_full), peer_eid); snprintf(key, sizeof(key), "%s/%s/%s/e%08x", eid_str, req->number, req->dcontext, crc); res |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); - snprintf(key, sizeof(key), "%s/%s/%s/e%08x", eid_str, req->number, req->dcontext, 0); + snprintf(key, sizeof(key), "%s/%s/%s/e%08x", eid_str, req->number, req->dcontext, (unsigned)0); res |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); snprintf(key, sizeof(key), "%s/%s/%s/r%s", eid_str, req->number, req->dcontext, eidroot_str); res |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); @@ -1261,7 +1261,7 @@ static int cache_lookup(struct dundi_request *req, dundi_eid *peer_eid, uint32_t /* Check for hints */ snprintf(key, sizeof(key), "hint/%s/%s/%s/e%08x", eid_str, tmp, req->dcontext, crc); res2 |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); - snprintf(key, sizeof(key), "hint/%s/%s/%s/e%08x", eid_str, tmp, req->dcontext, 0); + snprintf(key, sizeof(key), "hint/%s/%s/%s/e%08x", eid_str, tmp, req->dcontext, (unsigned)0); res2 |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); snprintf(key, sizeof(key), "hint/%s/%s/%s/r%s", eid_str, tmp, req->dcontext, eidroot_str); res2 |= cache_lookup_internal(now, req, key, eid_str_full, lowexpiration); @@ -2958,7 +2958,7 @@ static char *dundi_show_cache(struct ast_cli_entry *e, int cmd, struct ast_cli_a ptr = db_entry->data + length + 1; - if ((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) != 3)) { + if ((sscanf(ptr, "%30u/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) != 3)) { continue; } diff --git a/res/ael/pval.c b/res/ael/pval.c index dc05cf7f15..c0da0f03ff 100644 --- a/res/ael/pval.c +++ b/res/ael/pval.c @@ -1388,7 +1388,7 @@ static void find_pval_goto_item(pval *item, int lev) struct pval *p4; if (lev>100) { - ast_log(LOG_ERROR,"find_pval_goto in infinite loop! item_type: %d\n\n", item->type); + ast_log(LOG_ERROR,"find_pval_goto in infinite loop! item_type: %u\n\n", item->type); return; } diff --git a/res/res_agi.c b/res/res_agi.c index c41b202ea3..5d65607830 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -2599,12 +2599,12 @@ static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, co struct ast_channel *c; if (argc == 2) { /* no argument: supply info on the current channel */ - ast_agi_send(agi->fd, chan, "200 result=%d\n", ast_channel_state(chan)); + ast_agi_send(agi->fd, chan, "200 result=%u\n", ast_channel_state(chan)); return RESULT_SUCCESS; } else if (argc == 3) { /* one argument: look for info on the specified channel */ if ((c = ast_channel_get_by_name(argv[2]))) { - ast_agi_send(agi->fd, chan, "200 result=%d\n", ast_channel_state(c)); + ast_agi_send(agi->fd, chan, "200 result=%u\n", ast_channel_state(c)); c = ast_channel_unref(c); return RESULT_SUCCESS; } diff --git a/res/res_calendar.c b/res/res_calendar.c index 1691d29a2b..a9a082874b 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -687,7 +687,7 @@ static void *event_notification_duplicate(void *data) /*! \brief Generate 32 byte random string (stolen from chan_sip.c)*/ static char *generate_random_string(char *buf, size_t size) { - long val[4]; + unsigned long val[4]; int x; for (x = 0; x < 4; x++) { @@ -1356,7 +1356,7 @@ static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd, } else if (!strcasecmp(args.field, "end")) { snprintf(buf, len, "%ld", (long) entry->event->end); } else if (!strcasecmp(args.field, "busystate")) { - snprintf(buf, len, "%d", entry->event->busy_state); + snprintf(buf, len, "%u", entry->event->busy_state); } else if (!strcasecmp(args.field, "attendees")) { calendar_join_attendees(entry->event, buf, len); } else { @@ -1417,7 +1417,7 @@ static int calendar_write_exec(struct ast_channel *chan, const char *cmd, char * } if (fields.argc - 1 != values.argc) { - ast_log(LOG_WARNING, "CALENDAR_WRITE should have the same number of fields (%d) and values (%d)!\n", fields.argc - 1, values.argc); + ast_log(LOG_WARNING, "CALENDAR_WRITE should have the same number of fields (%u) and values (%u)!\n", fields.argc - 1, values.argc); goto write_cleanup; } @@ -1717,7 +1717,7 @@ static int calendar_event_read(struct ast_channel *chan, const char *cmd, char * } else if (!strcasecmp(data, "end")) { snprintf(buf, len, "%ld", (long)event->end); } else if (!strcasecmp(data, "busystate")) { - snprintf(buf, len, "%d", event->busy_state); + snprintf(buf, len, "%u", event->busy_state); } else if (!strcasecmp(data, "attendees")) { calendar_join_attendees(event, buf, len); } diff --git a/res/res_calendar_caldav.c b/res/res_calendar_caldav.c index b1dd628a89..39c76f10a4 100644 --- a/res/res_calendar_caldav.c +++ b/res/res_calendar_caldav.c @@ -201,7 +201,10 @@ static int caldav_write_event(struct ast_calendar_event *event) for (x = 0; x < 8; x++) { val[x] = ast_random(); } - ast_string_field_build(event, uid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]); + ast_string_field_build(event, uid, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + (unsigned)val[0], (unsigned)val[1], (unsigned)val[2], + (unsigned)val[3], (unsigned)val[4], (unsigned)val[5], + (unsigned)val[6], (unsigned)val[7]); } calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); @@ -400,7 +403,7 @@ static void caldav_add_event(icalcomponent *comp, struct icaltime_span *span, vo ast_string_field_set(event, uid, event->summary); } else { char tmp[100]; - snprintf(tmp, sizeof(tmp), "%lu", event->start); + snprintf(tmp, sizeof(tmp), "%ld", event->start); ast_string_field_set(event, uid, tmp); } } diff --git a/res/res_calendar_ews.c b/res/res_calendar_ews.c index 3cf0d745eb..3baee4785c 100644 --- a/res/res_calendar_ews.c +++ b/res/res_calendar_ews.c @@ -456,7 +456,7 @@ static int endelm(void *userdata, int state, const char *nspace, const char *nam } } else if (!strcmp(name, "Envelope")) { /* Events end */ - ast_debug(3, "EWS: XML: %d of %d event(s) has been parsed…\n", ao2_container_count(ctx->pvt->events), ctx->pvt->items); + ast_debug(3, "EWS: XML: %d of %u event(s) has been parsed…\n", ao2_container_count(ctx->pvt->events), ctx->pvt->items); if (ao2_container_count(ctx->pvt->events) >= ctx->pvt->items) { ast_debug(3, "EWS: XML: All events has been parsed, merging…\n"); ast_calendar_merge_events(ctx->pvt->owner, ctx->pvt->events); diff --git a/res/res_calendar_exchange.c b/res/res_calendar_exchange.c index e7beeafb2f..6b5a72b592 100644 --- a/res/res_calendar_exchange.c +++ b/res/res_calendar_exchange.c @@ -247,7 +247,9 @@ static struct ast_str *generate_exchange_uuid(struct ast_str *uid) for (x = 0; x < 8; x++) { val[x] = ast_random(); } - ast_str_set(&uid, 0, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]); + ast_str_set(&uid, 0, "%04x%04x-%04x-%04x-%04x-%04x%04x%04x", (unsigned)val[0], + (unsigned)val[1], (unsigned)val[2], (unsigned)val[3], (unsigned)val[4], + (unsigned)val[5], (unsigned)val[6], (unsigned)val[7]); return uid; } diff --git a/res/res_calendar_icalendar.c b/res/res_calendar_icalendar.c index 3aea7a4639..df3c621889 100644 --- a/res/res_calendar_icalendar.c +++ b/res/res_calendar_icalendar.c @@ -245,7 +245,7 @@ static void icalendar_add_event(icalcomponent *comp, struct icaltime_span *span, ast_string_field_set(event, uid, event->summary); } else { char tmp[100]; - snprintf(tmp, sizeof(tmp), "%lu", event->start); + snprintf(tmp, sizeof(tmp), "%ld", event->start); ast_string_field_set(event, uid, tmp); } } diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index eaf6deac27..739d4be1be 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -83,7 +83,7 @@ static void decode_chunk(char *chunk) { for (; *chunk; chunk++) { if (*chunk == '^' && strchr("0123456789ABCDEF", chunk[1]) && strchr("0123456789ABCDEF", chunk[2])) { - sscanf(chunk + 1, "%02hhX", chunk); + sscanf(chunk + 1, "%02hhX", (unsigned char *)chunk); memmove(chunk + 1, chunk + 3, strlen(chunk + 3) + 1); } } @@ -110,7 +110,7 @@ static SQLHSTMT custom_prepare(struct odbc_obj *obj, void *data) return NULL; } - ast_debug(1, "Skip: %lld; SQL: %s\n", cps->skip, cps->sql); + ast_debug(1, "Skip: %llu; SQL: %s\n", cps->skip, cps->sql); res = SQLPrepare(stmt, (unsigned char *)cps->sql, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { @@ -123,7 +123,7 @@ static SQLHSTMT custom_prepare(struct odbc_obj *obj, void *data) while ((newparam = va_arg(ap, const char *))) { newval = va_arg(ap, const char *); if ((1LL << count++) & cps->skip) { - ast_debug(1, "Skipping field '%s'='%s' (%llo/%llo)\n", newparam, newval, 1LL << (count - 1), cps->skip); + ast_debug(1, "Skipping field '%s'='%s' (%llo/%llo)\n", newparam, newval, 1ULL << (count - 1), cps->skip); continue; } ast_debug(1, "Parameter %d ('%s') = '%s'\n", x, newparam, newval); diff --git a/res/res_corosync.c b/res/res_corosync.c index e6044c3055..4b32055c78 100644 --- a/res/res_corosync.c +++ b/res/res_corosync.c @@ -230,13 +230,13 @@ static void *dispatch_thread_handler(void *data) if (pfd[0].revents & POLLIN) { if ((cs_err = cpg_dispatch(cpg_handle, CS_DISPATCH_ALL)) != CS_OK) { - ast_log(LOG_WARNING, "Failed CPG dispatch: %d\n", cs_err); + ast_log(LOG_WARNING, "Failed CPG dispatch: %u\n", cs_err); } } if (pfd[1].revents & POLLIN) { if ((cs_err = corosync_cfg_dispatch(cfg_handle, CS_DISPATCH_ALL)) != CS_OK) { - ast_log(LOG_WARNING, "Failed CFG dispatch: %d\n", cs_err); + ast_log(LOG_WARNING, "Failed CFG dispatch: %u\n", cs_err); } } @@ -313,7 +313,7 @@ static void ast_event_cb(const struct ast_event *event, void *data) * these events, so just send away. */ if ((cs_err = cpg_mcast_joined(cpg_handle, CPG_TYPE_FIFO, &iov, 1)) != CS_OK) { - ast_log(LOG_WARNING, "CPG mcast failed (%d)\n", cs_err); + ast_log(LOG_WARNING, "CPG mcast failed (%u)\n", cs_err); } } @@ -367,7 +367,7 @@ static char *corosync_show_members(struct ast_cli_entry *e, int cmd, struct ast_ continue; } - ast_cli(a->fd, "=== Node %d\n", i); + ast_cli(a->fd, "=== Node %u\n", i); ast_cli(a->fd, "=== --> Group: %s\n", cpg_desc.group.value); for (j = 0; j < num_addrs; j++) { @@ -377,7 +377,7 @@ static char *corosync_show_members(struct ast_cli_entry *e, int cmd, struct ast_ getnameinfo(sa, sa_len, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); - ast_cli(a->fd, "=== --> Address %d: %s\n", j + 1, buf); + ast_cli(a->fd, "=== --> Address %u: %s\n", j + 1, buf); } } diff --git a/res/res_crypto.c b/res/res_crypto.c index 7c38e3d28b..588e0de3ba 100644 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -532,7 +532,7 @@ static void md52sum(char *sum, unsigned char *md5) { int x; for (x = 0; x < 16; x++) { - sum += sprintf(sum, "%02x", *(md5++)); + sum += sprintf(sum, "%02x", (unsigned)*(md5++)); } } diff --git a/res/res_fax.c b/res/res_fax.c index 080233b897..8ca81db78f 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -403,7 +403,7 @@ static void debug_check_frame_for_silence(struct ast_fax_session *s, unsigned in history->consec_ms = 0; if ((last_consec_frames != 0)) { - ast_verb(6, "Channel '%s' fax session '%d', [ %.3ld.%.6ld ], %s sent %d frames (%d ms) of %s.\n", + ast_verb(6, "Channel '%s' fax session '%u', [ %.3ld.%.6ld ], %s sent %u frames (%u ms) of %s.\n", s->channame, s->id, (long) diff.tv_sec, (long int) diff.tv_usec, (c2s) ? "channel" : "stack", last_consec_frames, last_consec_ms, (wassil) ? "silence" : "energy"); @@ -803,7 +803,7 @@ const char *ast_fax_state_to_str(enum ast_fax_state state) case AST_FAX_STATE_INACTIVE: return "Inactive"; default: - ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state); + ast_log(LOG_WARNING, "unhandled FAX state: %u\n", state); return "Unknown"; } } @@ -1077,11 +1077,11 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d } /* link the session to the session container */ if (!(ao2_link(faxregistry.container, s))) { - ast_log(LOG_ERROR, "failed to add FAX session '%d' to container.\n", s->id); + ast_log(LOG_ERROR, "failed to add FAX session '%u' to container.\n", s->id); ao2_ref(s, -1); return NULL; } - ast_debug(4, "channel '%s' using FAX session '%d'\n", s->channame, s->id); + ast_debug(4, "channel '%s' using FAX session '%u'\n", s->channame, s->id); return s; } @@ -1192,7 +1192,7 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi pbx_builtin_setvar_helper(chan, "FAXBITRATE", S_OR(details->transfer_rate, NULL)); pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", S_OR(details->resolution, NULL)); - snprintf(buf, sizeof(buf), "%d", details->pages_transferred); + snprintf(buf, sizeof(buf), "%u", details->pages_transferred); pbx_builtin_setvar_helper(chan, "FAXPAGES", buf); } @@ -1214,7 +1214,7 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi #define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) \ do { \ - ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", ast_channel_name(chan), fax->id, reason, errorstr); \ + ast_log(LOG_ERROR, "channel '%s' FAX session '%u' failure, reason: '%s' (%s)\n", ast_channel_name(chan), fax->id, reason, errorstr); \ GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason); \ } while (0) @@ -1387,7 +1387,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det fax->smoother = NULL; } if (!(fax->smoother = ast_smoother_new(320))) { - ast_log(LOG_WARNING, "Channel '%s' FAX session '%d' failed to obtain a smoother.\n", ast_channel_name(chan), fax->id); + ast_log(LOG_WARNING, "Channel '%s' FAX session '%u' failed to obtain a smoother.\n", ast_channel_name(chan), fax->id); } } else { expected_frametype = AST_FRAME_MODEM; @@ -1475,7 +1475,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det report_fax_status(chan, details, "T.38 Negotiated"); - ast_verb(3, "Channel '%s' switched to T.38 FAX session '%d'.\n", ast_channel_name(chan), fax->id); + ast_verb(3, "Channel '%s' switched to T.38 FAX session '%u'.\n", ast_channel_name(chan), fax->id); } } else if ((frame->frametype == expected_frametype) && (!memcmp(&frame->subclass, &expected_framesubclass, sizeof(frame->subclass)))) { @@ -1783,14 +1783,14 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "maxrate is less than minrate"); set_channel_variables(chan, details); - ast_log(LOG_ERROR, "maxrate %d is less than minrate %d\n", details->maxrate, details->minrate); + ast_log(LOG_ERROR, "maxrate %u is less than minrate %u\n", details->maxrate, details->minrate); ao2_ref(details, -1); return -1; } if (check_modem_rate(details->modems, details->minrate)) { ast_fax_modem_to_str(details->modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %d\n", modems, details->minrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %u\n", modems, details->minrate); ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "incompatible 'modems' and 'minrate' settings"); set_channel_variables(chan, details); @@ -1800,7 +1800,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) if (check_modem_rate(details->modems, details->maxrate)) { ast_fax_modem_to_str(details->modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %d\n", modems, details->maxrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %u\n", modems, details->maxrate); ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "incompatible 'modems' and 'maxrate' settings"); set_channel_variables(chan, details); @@ -2269,14 +2269,14 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "maxrate is less than minrate"); set_channel_variables(chan, details); - ast_log(LOG_ERROR, "maxrate %d is less than minrate %d\n", details->maxrate, details->minrate); + ast_log(LOG_ERROR, "maxrate %u is less than minrate %u\n", details->maxrate, details->minrate); ao2_ref(details, -1); return -1; } if (check_modem_rate(details->modems, details->minrate)) { ast_fax_modem_to_str(details->modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %d\n", modems, details->minrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %u\n", modems, details->minrate); ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "incompatible 'modems' and 'minrate' settings"); set_channel_variables(chan, details); @@ -2286,7 +2286,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) if (check_modem_rate(details->modems, details->maxrate)) { ast_fax_modem_to_str(details->modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %d\n", modems, details->maxrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %u\n", modems, details->maxrate); ast_string_field_set(details, error, "INVALID_ARGUMENTS"); ast_string_field_set(details, resultstr, "incompatible 'modems' and 'maxrate' settings"); set_channel_variables(chan, details); @@ -3104,7 +3104,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct active = chan; break; default: - ast_log(LOG_WARNING, "unhandled framehook event %i\n", event); + ast_log(LOG_WARNING, "unhandled framehook event %u\n", event); ao2_ref(details, -1); return f; } @@ -3491,7 +3491,7 @@ static char *fax_session_tab_complete(struct ast_cli_args *a) tklen = strlen(a->word); i = ao2_iterator_init(faxregistry.container, 0); while ((s = ao2_iterator_next(&i))) { - snprintf(tbuf, sizeof(tbuf), "%d", s->id); + snprintf(tbuf, sizeof(tbuf), "%u", s->id); if (!strncasecmp(a->word, tbuf, tklen) && ++wordnum > a->n) { name = ast_strdup(tbuf); ao2_ref(s, -1); @@ -3594,7 +3594,7 @@ static char *cli_fax_show_capabilities(struct ast_cli_entry *e, int cmd, struct num_modules++; } AST_RWLIST_UNLOCK(&faxmodules); - ast_cli(a->fd, "%d registered modules\n\n", num_modules); + ast_cli(a->fd, "%u registered modules\n\n", num_modules); return CLI_SUCCESS; } @@ -3622,8 +3622,8 @@ static char *cli_fax_show_settings(struct ast_cli_entry *e, int cmd, struct ast_ ast_cli(a->fd, "FAX For Asterisk Settings:\n"); ast_cli(a->fd, "\tECM: %s\n", options.ecm ? "Enabled" : "Disabled"); ast_cli(a->fd, "\tStatus Events: %s\n", options.statusevents ? "On" : "Off"); - ast_cli(a->fd, "\tMinimum Bit Rate: %d\n", options.minrate); - ast_cli(a->fd, "\tMaximum Bit Rate: %d\n", options.maxrate); + ast_cli(a->fd, "\tMinimum Bit Rate: %u\n", options.minrate); + ast_cli(a->fd, "\tMaximum Bit Rate: %u\n", options.maxrate); ast_fax_modem_to_str(options.modems, modems, sizeof(modems)); ast_cli(a->fd, "\tModem Modulations Allowed: %s\n", modems); ast_cli(a->fd, "\n\nFAX Technology Modules:\n\n"); @@ -3657,7 +3657,7 @@ static char *cli_fax_show_session(struct ast_cli_entry *e, int cmd, struct ast_c return CLI_SHOWUSAGE; } - if (sscanf(a->argv[3], "%d", &tmp.id) != 1) { + if (sscanf(a->argv[3], "%u", &tmp.id) != 1) { ast_log(LOG_ERROR, "invalid session id: '%s'\n", a->argv[3]); return RESULT_SUCCESS; } @@ -3764,7 +3764,7 @@ static char *cli_fax_show_sessions(struct ast_cli_entry *e, int cmd, struct ast_ filenames = generate_filenames_string(s->details, "", ", "); - ast_cli(a->fd, "%-20.20s %-10.10s %-10d %-5.5s %-10.10s %-15.15s %-30s\n", + ast_cli(a->fd, "%-20.20s %-10.10s %-10u %-5.5s %-10.10s %-15.15s %-30s\n", s->channame, s->tech->type, s->id, cli_session_type(s), cli_session_operation(s), @@ -3878,28 +3878,28 @@ static int set_config(int reload) } if (options.maxrate < options.minrate) { - ast_log(LOG_ERROR, "maxrate %d is less than minrate %d\n", options.maxrate, options.minrate); + ast_log(LOG_ERROR, "maxrate %u is less than minrate %u\n", options.maxrate, options.minrate); res = -1; goto end; } if (options.minrate == 2400 && (options.modems & AST_FAX_MODEM_V27) && !(options.modems & (AST_FAX_MODEM_V34))) { ast_fax_modem_to_str(options.modems, modems, sizeof(modems)); - ast_log(LOG_WARNING, "'modems' setting '%s' is no longer accepted with 'minrate' setting %d\n", modems, options.minrate); + ast_log(LOG_WARNING, "'modems' setting '%s' is no longer accepted with 'minrate' setting %u\n", modems, options.minrate); ast_log(LOG_WARNING, "'minrate' has been reset to 4800, please update res_fax.conf.\n"); options.minrate = 4800; } if (check_modem_rate(options.modems, options.minrate)) { ast_fax_modem_to_str(options.modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %d\n", modems, options.minrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'minrate' setting %u\n", modems, options.minrate); res = -1; goto end; } if (check_modem_rate(options.modems, options.maxrate)) { ast_fax_modem_to_str(options.modems, modems, sizeof(modems)); - ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %d\n", modems, options.maxrate); + ast_log(LOG_ERROR, "'modems' setting '%s' is incompatible with 'maxrate' setting %u\n", modems, options.maxrate); res = -1; goto end; } @@ -3954,11 +3954,11 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data } else if (!strcasecmp(data, "localstationid")) { ast_copy_string(buf, details->localstationid, len); } else if (!strcasecmp(data, "maxrate")) { - snprintf(buf, len, "%d", details->maxrate); + snprintf(buf, len, "%u", details->maxrate); } else if (!strcasecmp(data, "minrate")) { - snprintf(buf, len, "%d", details->minrate); + snprintf(buf, len, "%u", details->minrate); } else if (!strcasecmp(data, "pages")) { - snprintf(buf, len, "%d", details->pages_transferred); + snprintf(buf, len, "%u", details->pages_transferred); } else if (!strcasecmp(data, "rate")) { ast_copy_string(buf, details->transfer_rate, len); } else if (!strcasecmp(data, "remotestationid")) { @@ -3966,7 +3966,7 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data } else if (!strcasecmp(data, "resolution")) { ast_copy_string(buf, details->resolution, len); } else if (!strcasecmp(data, "sessionid")) { - snprintf(buf, len, "%d", details->id); + snprintf(buf, len, "%u", details->id); } else if (!strcasecmp(data, "status")) { ast_copy_string(buf, details->result, len); } else if (!strcasecmp(data, "statusstr")) { diff --git a/res/res_fax_spandsp.c b/res/res_fax_spandsp.c index 5c88c85f5c..2226d20c4c 100644 --- a/res/res_fax_spandsp.c +++ b/res/res_fax_spandsp.c @@ -362,7 +362,7 @@ static void t30_phase_e_handler(t30_state_t *t30_state, void *data, int completi const char *c; t30_stats_t stats; - ast_debug(5, "FAX session '%d' entering phase E\n", s->id); + ast_debug(5, "FAX session '%u' entering phase E\n", s->id); p->isdone = 1; @@ -379,7 +379,7 @@ static void t30_phase_e_handler(t30_state_t *t30_state, void *data, int completi ast_string_field_set(s->details, resultstr, t30_completion_code_to_str(completion_code)); - ast_debug(5, "FAX session '%d' completed with result: %s (%s)\n", s->id, s->details->result, s->details->resultstr); + ast_debug(5, "FAX session '%u' completed with result: %s (%s)\n", s->id, s->details->result, s->details->resultstr); if ((c = t30_get_tx_ident(t30_state))) { ast_string_field_set(s->details, localstationid, c); @@ -537,7 +537,7 @@ static void *spandsp_fax_new(struct ast_fax_session *s, struct ast_fax_tech_toke } if (!(p->timer = ast_timer_open())) { - ast_log(LOG_ERROR, "Channel '%s' FAX session '%d' failed to create timing source.\n", s->channame, s->id); + ast_log(LOG_ERROR, "Channel '%s' FAX session '%u' failed to create timing source.\n", s->channame, s->id); goto e_free; } @@ -611,14 +611,14 @@ static struct ast_frame *spandsp_fax_read(struct ast_fax_session *s) ast_format_set(&fax_frame.subclass.format, AST_FORMAT_SLINEAR, 0); if (ast_timer_ack(p->timer, 1) < 0) { - ast_log(LOG_ERROR, "Failed to acknowledge timer for FAX session '%d'\n", s->id); + ast_log(LOG_ERROR, "Failed to acknowledge timer for FAX session '%u'\n", s->id); return NULL; } /* XXX do we need to lock here? */ if (p->isdone) { s->state = AST_FAX_STATE_COMPLETE; - ast_debug(5, "FAX session '%d' is complete.\n", s->id); + ast_debug(5, "FAX session '%u' is complete.\n", s->id); return NULL; } @@ -661,7 +661,7 @@ static int spandsp_v21_detect(struct ast_fax_session *s, const struct ast_frame return -1; } - ast_debug(5, "frame={ datalen=%d, samples=%d, mallocd=%d, src=%s, flags=%d, ts=%ld, len=%ld, seqno=%d, data.ptr=%p, subclass.format.id=%d }\n", f->datalen, f->samples, f->mallocd, f->src, f->flags, f->ts, f->len, f->seqno, f->data.ptr, f->subclass.format.id); + ast_debug(5, "frame={ datalen=%d, samples=%d, mallocd=%d, src=%s, flags=%u, ts=%ld, len=%ld, seqno=%d, data.ptr=%p, subclass.format.id=%u }\n", f->datalen, f->samples, f->mallocd, f->src, f->flags, f->ts, f->len, f->seqno, f->data.ptr, f->subclass.format.id); /* slinear frame can be passed to spandsp */ if (f->subclass.format.id == AST_FORMAT_SLINEAR) { @@ -684,7 +684,7 @@ static int spandsp_v21_detect(struct ast_fax_session *s, const struct ast_frame /* frame in other formats cannot be passed to spandsp, it could cause segfault */ } else { - ast_log(LOG_WARNING, "Unknown frame format %d, v.21 detection skipped\n", f->subclass.format.id); + ast_log(LOG_WARNING, "Unknown frame format %u, v.21 detection skipped\n", f->subclass.format.id); return -1; } @@ -720,7 +720,7 @@ static int spandsp_fax_write(struct ast_fax_session *s, const struct ast_frame * /* XXX do we need to lock here? */ if (s->state == AST_FAX_STATE_COMPLETE) { - ast_log(LOG_WARNING, "FAX session '%d' is in the '%s' state.\n", s->id, ast_fax_state_to_str(s->state)); + ast_log(LOG_WARNING, "FAX session '%u' is in the '%s' state.\n", s->id, ast_fax_state_to_str(s->state)); return -1; } @@ -964,7 +964,7 @@ static int spandsp_fax_start(struct ast_fax_session *s) /* start the timer */ if (ast_timer_set_rate(p->timer, SPANDSP_FAX_TIMER_RATE)) { - ast_log(LOG_ERROR, "FAX session '%d' error setting rate on timing source.\n", s->id); + ast_log(LOG_ERROR, "FAX session '%u' error setting rate on timing source.\n", s->id); return -1; } @@ -1022,7 +1022,7 @@ static char *spandsp_fax_cli_show_session(struct ast_fax_session *s, int fd) if (s->details->caps & AST_FAX_TECH_GATEWAY) { struct spandsp_pvt *p = s->tech_pvt; - ast_cli(fd, "%-22s : %d\n", "session", s->id); + ast_cli(fd, "%-22s : %u\n", "session", s->id); ast_cli(fd, "%-22s : %s\n", "operation", "Gateway"); ast_cli(fd, "%-22s : %s\n", "state", ast_fax_state_to_str(s->state)); if (s->state != AST_FAX_STATE_UNINITIALIZED) { @@ -1033,13 +1033,13 @@ static char *spandsp_fax_cli_show_session(struct ast_fax_session *s, int fd) ast_cli(fd, "%-22s : %d\n", "Page Number", stats.pages_transferred + 1); } } else if (s->details->caps & AST_FAX_TECH_V21_DETECT) { - ast_cli(fd, "%-22s : %d\n", "session", s->id); + ast_cli(fd, "%-22s : %u\n", "session", s->id); ast_cli(fd, "%-22s : %s\n", "operation", "V.21 Detect"); ast_cli(fd, "%-22s : %s\n", "state", ast_fax_state_to_str(s->state)); } else { struct spandsp_pvt *p = s->tech_pvt; - ast_cli(fd, "%-22s : %d\n", "session", s->id); + ast_cli(fd, "%-22s : %u\n", "session", s->id); ast_cli(fd, "%-22s : %s\n", "operation", (s->details->caps & AST_FAX_TECH_RECEIVE) ? "Receive" : "Transmit"); ast_cli(fd, "%-22s : %s\n", "state", ast_fax_state_to_str(s->state)); if (s->state != AST_FAX_STATE_UNINITIALIZED) { diff --git a/res/res_format_attr_celt.c b/res/res_format_attr_celt.c index aea3eb482e..1249f04723 100644 --- a/res/res_format_attr_celt.c +++ b/res/res_format_attr_celt.c @@ -65,7 +65,7 @@ static void celt_sdp_generate(const struct ast_format_attr *format_attr, unsigne return; } - ast_str_append(str, 0, "a=fmtp:%d framesize=%d\r\n", payload, attr->framesize); + ast_str_append(str, 0, "a=fmtp:%u framesize=%u\r\n", payload, attr->framesize); } static enum ast_format_cmp_res celt_cmp(const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2) @@ -127,7 +127,7 @@ static int celt_isset(const struct ast_format_attr *fattr, va_list ap) } break; default: - ast_log(LOG_WARNING, "unknown attribute type %d\n", key); + ast_log(LOG_WARNING, "unknown attribute type %u\n", key); return -1; } } @@ -172,7 +172,7 @@ static void celt_set(struct ast_format_attr *fattr, va_list ap) attr->framesize = (va_arg(ap, int)); break; default: - ast_log(LOG_WARNING, "unknown attribute type %d\n", key); + ast_log(LOG_WARNING, "unknown attribute type %u\n", key); } } } diff --git a/res/res_format_attr_h263.c b/res/res_format_attr_h263.c index 2ca39a9279..8ec28aac9b 100644 --- a/res/res_format_attr_h263.c +++ b/res/res_format_attr_h263.c @@ -193,7 +193,7 @@ static void h263_format_attr_sdp_generate(const struct ast_format_attr *format_a } if (!added) { - ast_str_append(str, 0, "a=fmtp:%d CUSTOM=%u,%u,%u", payload, format_attr->format_attr[H263_ATTR_KEY_CUSTOM_XMAX], + ast_str_append(str, 0, "a=fmtp:%u CUSTOM=%u,%u,%u", payload, format_attr->format_attr[H263_ATTR_KEY_CUSTOM_XMAX], format_attr->format_attr[H263_ATTR_KEY_CUSTOM_YMAX], format_attr->format_attr[H263_ATTR_KEY_CUSTOM_MPI]); added = 1; } else { @@ -206,7 +206,7 @@ static void h263_format_attr_sdp_generate(const struct ast_format_attr *format_a } if (!added) { - ast_str_append(str, 0, "a=fmtp:%d PAR=%u:%u", payload, format_attr->format_attr[H263_ATTR_KEY_PAR_WIDTH], + ast_str_append(str, 0, "a=fmtp:%u PAR=%u:%u", payload, format_attr->format_attr[H263_ATTR_KEY_PAR_WIDTH], format_attr->format_attr[H263_ATTR_KEY_PAR_HEIGHT]); added = 1; } else { @@ -219,7 +219,7 @@ static void h263_format_attr_sdp_generate(const struct ast_format_attr *format_a } if (!added) { - ast_str_append(str, 0, "a=fmtp:%d P=%u", payload, format_attr->format_attr[H263_ATTR_KEY_P_SUB1]); + ast_str_append(str, 0, "a=fmtp:%u P=%u", payload, format_attr->format_attr[H263_ATTR_KEY_P_SUB1]); added = 1; } else { ast_str_append(str, 0, ";P=%u", format_attr->format_attr[H263_ATTR_KEY_P_SUB1]); @@ -237,7 +237,7 @@ static void h263_format_attr_sdp_generate(const struct ast_format_attr *format_a } else if ((name = h263_attr_key_to_str(i, format_attr))) { if (!added) { - ast_str_append(str, 0, "a=fmtp:%d %s=%u", payload, name, format_attr->format_attr[i]); + ast_str_append(str, 0, "a=fmtp:%u %s=%u", payload, name, format_attr->format_attr[i]); added = 1; } else { ast_str_append(str, 0, ";%s=%u", name, format_attr->format_attr[i]); diff --git a/res/res_format_attr_h264.c b/res/res_format_attr_h264.c index eae1aa36ef..5ecde3f3f9 100644 --- a/res/res_format_attr_h264.c +++ b/res/res_format_attr_h264.c @@ -260,7 +260,7 @@ static void h264_format_attr_sdp_generate(const struct ast_format_attr *format_a ast_base64encode(pps, ppsdecoded, format_attr->format_attr[H264_ATTR_KEY_PPS_LEN], H264_MAX_SPS_PPS_SIZE); if (!added) { - ast_str_append(str, 0, "a=fmtp:%d sprop-parameter-sets=%s,%s", payload, sps, pps); + ast_str_append(str, 0, "a=fmtp:%u sprop-parameter-sets=%s,%s", payload, sps, pps); added = 1; } else { ast_str_append(str, 0, ";sprop-parameter-sets=%s,%s", sps, pps); @@ -268,7 +268,7 @@ static void h264_format_attr_sdp_generate(const struct ast_format_attr *format_a } else if (i == H264_ATTR_KEY_PROFILE_IDC && format_attr->format_attr[H264_ATTR_KEY_PROFILE_IDC] && format_attr->format_attr[H264_ATTR_KEY_PROFILE_IOP] && format_attr->format_attr[H264_ATTR_KEY_LEVEL]) { if (!added) { - ast_str_append(str, 0, "a=fmtp:%d profile-level-id=%X%X%X", payload, format_attr->format_attr[H264_ATTR_KEY_PROFILE_IDC], + ast_str_append(str, 0, "a=fmtp:%u profile-level-id=%X%X%X", payload, format_attr->format_attr[H264_ATTR_KEY_PROFILE_IDC], format_attr->format_attr[H264_ATTR_KEY_PROFILE_IOP], format_attr->format_attr[H264_ATTR_KEY_LEVEL]); added = 1; } else { @@ -277,7 +277,7 @@ static void h264_format_attr_sdp_generate(const struct ast_format_attr *format_a } } else if ((name = h264_attr_key_to_str(i)) && h264_attr_key_addable(format_attr, i)) { if (!added) { - ast_str_append(str, 0, "a=fmtp:%d %s=%u", payload, name, format_attr->format_attr[i]); + ast_str_append(str, 0, "a=fmtp:%u %s=%u", payload, name, format_attr->format_attr[i]); added = 1; } else { ast_str_append(str, 0, ";%s=%u", name, format_attr->format_attr[i]); diff --git a/res/res_format_attr_silk.c b/res/res_format_attr_silk.c index 7d4fa5bf84..075570fb52 100644 --- a/res/res_format_attr_silk.c +++ b/res/res_format_attr_silk.c @@ -70,11 +70,11 @@ static void silk_sdp_generate(const struct ast_format_attr *format_attr, unsigne struct silk_attr *attr = (struct silk_attr *) format_attr; if ((attr->maxbitrate > 5000) && (attr->maxbitrate < 40000)) { - ast_str_append(str, 0, "a=fmtp:%d maxaveragebitrate=%d\r\n", payload, attr->maxbitrate); + ast_str_append(str, 0, "a=fmtp:%u maxaveragebitrate=%u\r\n", payload, attr->maxbitrate); } - ast_str_append(str, 0, "a=fmtp:%d usedtx=%d\r\n", payload, attr->dtx); - ast_str_append(str, 0, "a=fmtp:%d useinbandfec=%d\r\n", payload, attr->fec); + ast_str_append(str, 0, "a=fmtp:%u usedtx=%u\r\n", payload, attr->dtx); + ast_str_append(str, 0, "a=fmtp:%u useinbandfec=%u\r\n", payload, attr->fec); } static enum ast_format_cmp_res silk_cmp(const struct ast_format_attr *fattr1, const struct ast_format_attr *fattr2) @@ -152,7 +152,7 @@ static int silk_isset(const struct ast_format_attr *fattr, va_list ap) } break; default: - ast_log(LOG_WARNING, "unknown attribute type %d\n", key); + ast_log(LOG_WARNING, "unknown attribute type %u\n", key); return -1; } } @@ -213,7 +213,7 @@ static void silk_set(struct ast_format_attr *fattr, va_list ap) attr->packetloss_percentage = (va_arg(ap, int)); break; default: - ast_log(LOG_WARNING, "unknown attribute type %d\n", key); + ast_log(LOG_WARNING, "unknown attribute type %u\n", key); } } } diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index b75efbe7a6..fdcc278cd4 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -435,7 +435,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read)(struct ast_websocket *session, cha *payload = &buf[frame_size]; /* payload will start here, at the end of the options, if any */ frame_size = frame_size + (*payload_len); /* final frame size is header + optional headers + payload data */ if (frame_size > MAXIMUM_FRAME_SIZE) { - ast_log(LOG_WARNING, "Cannot fit huge websocket frame of %zd bytes\n", frame_size); + ast_log(LOG_WARNING, "Cannot fit huge websocket frame of %zu bytes\n", frame_size); /* The frame won't fit :-( */ ast_websocket_close(session, 1009); return -1; @@ -454,7 +454,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read)(struct ast_websocket *session, cha } if (!(new_payload = ast_realloc(session->payload, (session->payload_len + *payload_len)))) { - ast_log(LOG_WARNING, "Failed allocation: %p, %zd, %"PRIu64"\n", + ast_log(LOG_WARNING, "Failed allocation: %p, %zu, %"PRIu64"\n", session->payload, session->payload_len, *payload_len); *payload_len = 0; ast_websocket_close(session, 1009); @@ -506,7 +506,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read)(struct ast_websocket *session, cha session->closing = 1; } else { - ast_log(LOG_WARNING, "WebSocket unknown opcode %d\n", *opcode); + ast_log(LOG_WARNING, "WebSocket unknown opcode %u\n", *opcode); /* We received an opcode that we don't understand, the RFC states that 1003 is for a type of data that can't be accepted... opcodes * fit that, I think. */ ast_websocket_close(session, 1003); @@ -713,7 +713,7 @@ static void websocket_echo_callback(struct ast_websocket *session, struct ast_va } else if (opcode == AST_WEBSOCKET_OPCODE_CLOSE) { break; } else { - ast_debug(1, "Ignored WebSocket opcode %d\n", opcode); + ast_debug(1, "Ignored WebSocket opcode %u\n", opcode); } } diff --git a/res/res_jabber.c b/res/res_jabber.c index e4556254ae..b465f509c2 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -1807,7 +1807,7 @@ static int aji_act_hook(void *data, int type, iks *node) aji_handle_iq(client, node); break; default: - ast_debug(1, "JABBER: I don't know anything about paktype '%d'\n", pak->type); + ast_debug(1, "JABBER: I don't know anything about paktype '%u'\n", pak->type); break; } @@ -2535,35 +2535,35 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak) } switch (pak->subtype) { case IKS_TYPE_AVAILABLE: - ast_debug(3, "JABBER: I am available ^_* %i\n", pak->subtype); + ast_debug(3, "JABBER: I am available ^_* %u\n", pak->subtype); break; case IKS_TYPE_UNAVAILABLE: - ast_debug(3, "JABBER: I am unavailable ^_* %i\n", pak->subtype); + ast_debug(3, "JABBER: I am unavailable ^_* %u\n", pak->subtype); break; default: - ast_debug(3, "JABBER: Ohh sexy and the wrong type: %i\n", pak->subtype); + ast_debug(3, "JABBER: Ohh sexy and the wrong type: %u\n", pak->subtype); } switch (pak->show) { case IKS_SHOW_UNAVAILABLE: - ast_debug(3, "JABBER: type: %i subtype %i\n", pak->subtype, pak->show); + ast_debug(3, "JABBER: type: %u subtype %u\n", pak->subtype, pak->show); break; case IKS_SHOW_AVAILABLE: ast_debug(3, "JABBER: type is available\n"); break; case IKS_SHOW_CHAT: - ast_debug(3, "JABBER: type: %i subtype %i\n", pak->subtype, pak->show); + ast_debug(3, "JABBER: type: %u subtype %u\n", pak->subtype, pak->show); break; case IKS_SHOW_AWAY: ast_debug(3, "JABBER: type is away\n"); break; case IKS_SHOW_XA: - ast_debug(3, "JABBER: type: %i subtype %i\n", pak->subtype, pak->show); + ast_debug(3, "JABBER: type: %u subtype %u\n", pak->subtype, pak->show); break; case IKS_SHOW_DND: - ast_debug(3, "JABBER: type: %i subtype %i\n", pak->subtype, pak->show); + ast_debug(3, "JABBER: type: %u subtype %u\n", pak->subtype, pak->show); break; default: - ast_debug(3, "JABBER: Kinky! how did that happen %i\n", pak->show); + ast_debug(3, "JABBER: Kinky! how did that happen %u\n", pak->show); } if (found) { @@ -2574,7 +2574,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak) found->priority, S_OR(found->description, "")); } else { manager_event(EVENT_FLAG_USER, "JabberStatus", - "Account: %s\r\nJID: %s\r\nStatus: %d\r\n", + "Account: %s\r\nJID: %s\r\nStatus: %u\r\n", client->name, pak->from->partial, pak->show ? pak->show : IKS_SHOW_UNAVAILABLE); } } @@ -3248,9 +3248,9 @@ static void aji_mwi_cb(const struct ast_event *ast_event, void *data) client = ASTOBJ_REF((struct aji_client *) data); mailbox = ast_event_get_ie_str(ast_event, AST_EVENT_IE_MAILBOX); context = ast_event_get_ie_str(ast_event, AST_EVENT_IE_CONTEXT); - snprintf(oldmsgs, sizeof(oldmsgs), "%d", + snprintf(oldmsgs, sizeof(oldmsgs), "%u", ast_event_get_ie_uint(ast_event, AST_EVENT_IE_OLDMSGS)); - snprintf(newmsgs, sizeof(newmsgs), "%d", + snprintf(newmsgs, sizeof(newmsgs), "%u", ast_event_get_ie_uint(ast_event, AST_EVENT_IE_NEWMSGS)); aji_publish_mwi(client, mailbox, context, oldmsgs, newmsgs); ASTOBJ_UNREF(client, ast_aji_client_destroy); @@ -3340,7 +3340,7 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak) } if (!strcasecmp(iks_name(item_content), "state")) { if ((cachable_str = iks_find_attrib(item_content, "cachable"))) { - sscanf(cachable_str, "%30d", &cachable); + sscanf(cachable_str, "%30u", &cachable); } device_state = iks_find_cdata(item, "state"); if (!(event = ast_event_new(AST_EVENT_DEVICE_STATE_CHANGE, diff --git a/res/res_monitor.c b/res/res_monitor.c index 02a2cd2310..b86ea109e3 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -326,9 +326,9 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha } } else { ast_mutex_lock(&monitorlock); - snprintf(monitor->read_filename, FILENAME_MAX, "%s/audio-in-%ld", + snprintf(monitor->read_filename, FILENAME_MAX, "%s/audio-in-%lu", ast_config_AST_MONITOR_DIR, seq); - snprintf(monitor->write_filename, FILENAME_MAX, "%s/audio-out-%ld", + snprintf(monitor->write_filename, FILENAME_MAX, "%s/audio-out-%lu", ast_config_AST_MONITOR_DIR, seq); seq++; ast_mutex_unlock(&monitorlock); diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 0efc23732a..8df662c606 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -231,7 +231,7 @@ static int reload(void); #define mohclass_ref(class,string) (ao2_t_ref((class), +1, (string)), class) #ifndef REF_DEBUG -#define mohclass_unref(class,string) (ao2_t_ref((class), -1, (string)), (struct mohclass *) NULL) +#define mohclass_unref(class,string) ({ ao2_t_ref((class), -1, (string)); (struct mohclass *) NULL; }) #else #define mohclass_unref(class,string) _mohclass_unref(class, string, __FILE__,__LINE__,__PRETTY_FUNCTION__) static struct mohclass *_mohclass_unref(struct mohclass *class, const char *tag, const char *file, int line, const char *funcname) diff --git a/res/res_odbc.c b/res/res_odbc.c index 3de4737be5..04ed002051 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -986,7 +986,7 @@ static char *handle_cli_odbc_show(struct ast_cli_entry *e, int cmd, struct ast_c if (class->haspool) { struct ao2_iterator aoi2 = ao2_iterator_init(class->obj_container, 0); - ast_cli(a->fd, " Pooled: Yes\n Limit: %d\n Connections in use: %d\n", class->limit, class->count); + ast_cli(a->fd, " Pooled: Yes\n Limit: %u\n Connections in use: %d\n", class->limit, class->count); while ((current = ao2_iterator_next(&aoi2))) { ao2_lock(current); diff --git a/res/res_pktccops.c b/res/res_pktccops.c index 80726f08ba..747281952b 100644 --- a/res/res_pktccops.c +++ b/res/res_pktccops.c @@ -397,7 +397,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) return -1; } - ast_debug(3, "COPS: sending opcode: %i len: %i\n", sendmsg->opcode, sendmsg->length); + ast_debug(3, "COPS: sending opcode: %i len: %u\n", sendmsg->opcode, sendmsg->length); if (sendmsg->length < COPS_HEADER_SIZE) { ast_log(LOG_WARNING, "COPS: invalid msg size!!!\n"); return -1; @@ -418,7 +418,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) while(pobject != NULL) { ast_debug(3, "COPS: Sending Object : cnum: %i ctype %i len: %i\n", pobject->cnum, pobject->ctype, pobject->length); if (sendmsg->length < bufpos + pobject->length) { - ast_log(LOG_WARNING, "COPS: Invalid msg size len: %i objectlen: %i\n", sendmsg->length, pobject->length); + ast_log(LOG_WARNING, "COPS: Invalid msg size len: %u objectlen: %i\n", sendmsg->length, pobject->length); free(buf); return -1; } @@ -426,7 +426,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) *(buf + bufpos + 2) = pobject->cnum; *(buf + bufpos + 3) = pobject->ctype; if (sendmsg->length < pobject->length + bufpos) { - ast_log(LOG_WARNING, "COPS: Error sum of object len more the msg len %i < %i\n", sendmsg->length, pobject->length + bufpos); + ast_log(LOG_WARNING, "COPS: Error sum of object len more the msg len %u < %i\n", sendmsg->length, pobject->length + bufpos); free(buf); return -1; } @@ -726,7 +726,7 @@ static void *do_pktccops(void *data) AST_LIST_TRAVERSE(&cmts_list, cmts, list) { if (last_exec != time(NULL)) { if (cmts->state == 2 && cmts->katimer + cmts->keepalive < time(NULL)) { - ast_log(LOG_WARNING, "KA timer (%is) expired cmts: %s\n", cmts->keepalive, cmts->name); + ast_log(LOG_WARNING, "KA timer (%us) expired cmts: %s\n", cmts->keepalive, cmts->name); cmts->state = 0; cmts->katimer = -1; close(cmts->sfd); @@ -799,15 +799,16 @@ static void *do_pktccops(void *data) if ((idx = ast_poll_fd_index(pfds, nfds, cmts->sfd)) > -1 && (pfds[idx].revents & POLLIN)) { len = cops_getmsg(cmts->sfd, recmsg); if (len > 0) { - ast_debug(3, "COPS: got from %s:\n Header: versflag=0x%.2x opcode=%i clienttype=0x%.4x msglength=%i\n", - cmts->name, recmsg->verflag, recmsg->opcode, recmsg->clienttype, recmsg->length); + ast_debug(3, "COPS: got from %s:\n Header: versflag=0x%.2x opcode=%i clienttype=0x%.4x msglength=%u\n", + cmts->name, (unsigned)recmsg->verflag, + recmsg->opcode, (unsigned)recmsg->clienttype, recmsg->length); if (recmsg->object != NULL) { pobject = recmsg->object; while (pobject != NULL) { ast_debug(3, " OBJECT: length=%i cnum=%i ctype=%i\n", pobject->length, pobject->cnum, pobject->ctype); if (recmsg->opcode == 1 && pobject->cnum == 1 && pobject->ctype == 1 ) { cmts->handle = ntohl(*((uint32_t *) pobject->contents)); - ast_debug(3, " REQ client handle: %i\n", cmts->handle); + ast_debug(3, " REQ client handle: %u\n", cmts->handle); cmts->state = 2; cmts->katimer = time(NULL); } else if (pobject->cnum == 9 && pobject->ctype == 1) { @@ -823,7 +824,7 @@ static void *do_pktccops(void *data) while (sobjp < (pobject->contents + pobject->length - 4)) { sobjlen = ntohs(*((uint16_t *) sobjp)); snst = ntohs(*((uint16_t *) (sobjp + 2))); - ast_debug(3, " S-Num S-type: 0x%.4x len: %i\n", snst, sobjlen); + ast_debug(3, " S-Num S-type: 0x%.4x len: %i\n", (unsigned)snst, sobjlen); if (snst == 0x0101 ) { recvtrid = ntohs(*((uint16_t *) (sobjp + 4))); scommand = ntohs(*((uint16_t *) (sobjp + 6))); @@ -843,7 +844,7 @@ static void *do_pktccops(void *data) } else if (snst == 0x0d01) { reason = ntohs(*((uint16_t *) (sobjp + 4))); subreason = ntohs(*((uint16_t *) (sobjp + 6))); - ast_debug(3, " Reason: %u Subreason: %u\n", reason, subreason); + ast_debug(3, " Reason: %d Subreason: %d\n", reason, subreason); } sobjp += sobjlen; if (!sobjlen) diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 814288b243..7f731a894d 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -860,7 +860,7 @@ static int ast_rtp_dtls_set_configuration(struct ast_rtp_instance *instance, con } for (i = 0; i < size; i++) { - sprintf(local_fingerprint, "%.2X:", fingerprint[i]); + sprintf(local_fingerprint, "%.2X:", (unsigned)fingerprint[i]); local_fingerprint += 3; } @@ -1482,7 +1482,7 @@ static int dtls_srtp_setup(struct ast_rtp *rtp, struct ast_srtp *srtp, struct as } if (res_srtp_policy->set_suite(local_policy, rtp->suite)) { - ast_log(LOG_WARNING, "Could not set suite to '%d' on local policy of '%p' when setting up DTLS-SRTP\n", rtp->suite, rtp); + ast_log(LOG_WARNING, "Could not set suite to '%u' on local policy of '%p' when setting up DTLS-SRTP\n", rtp->suite, rtp); goto error; } @@ -1502,7 +1502,7 @@ static int dtls_srtp_setup(struct ast_rtp *rtp, struct ast_srtp *srtp, struct as } if (res_srtp_policy->set_suite(remote_policy, rtp->suite)) { - ast_log(LOG_WARNING, "Could not set suite to '%d' on remote policy of '%p' when setting up DTLS-SRTP\n", rtp->suite, rtp); + ast_log(LOG_WARNING, "Could not set suite to '%u' on remote policy of '%p' when setting up DTLS-SRTP\n", rtp->suite, rtp); goto error; } @@ -2188,7 +2188,7 @@ static int ast_rtp_dtmf_begin(struct ast_rtp_instance *instance, char digit) update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTP, &remote_address); #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); @@ -2241,7 +2241,7 @@ static int ast_rtp_dtmf_continuation(struct ast_rtp_instance *instance) #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); @@ -2290,7 +2290,7 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000)); if (duration > 0 && (measured_samples = duration * rtp_get_rate(&rtp->f.subclass.format) / 1000) > rtp->send_duration) { - ast_debug(2, "Adjusting final end duration from %u to %u\n", rtp->send_duration, measured_samples); + ast_debug(2, "Adjusting final end duration from %d to %u\n", rtp->send_duration, measured_samples); rtp->send_duration = measured_samples; } @@ -2319,7 +2319,7 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); @@ -2605,7 +2605,7 @@ static int ast_rtcp_write_sr(struct ast_rtp_instance *instance) ast_verbose(" Sent packets: %u\n", rtp->txcount); ast_verbose(" Sent octets: %u\n", rtp->txoctetcount); ast_verbose(" Report block:\n"); - ast_verbose(" Fraction lost: %u\n", fraction); + ast_verbose(" Fraction lost: %d\n", fraction); ast_verbose(" Cumulative loss: %u\n", lost); ast_verbose(" IA jitter: %.4f\n", rtp->rxjitter); ast_verbose(" Their last SR: %u\n", rtp->rtcp->themrxlsr); @@ -2618,7 +2618,7 @@ static int ast_rtcp_write_sr(struct ast_rtp_instance *instance) "SentPackets: %u\r\n" "SentOctets: %u\r\n" "ReportBlock:\r\n" - "FractionLost: %u\r\n" + "FractionLost: %d\r\n" "CumulativeLoss: %u\r\n" "IAJitter: %.4f\r\n" "TheirLastSR: %u\r\n" @@ -2695,7 +2695,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame if (abs(rtp->lastts - pred) < MAX_TIMESTAMP_SKEW) { rtp->lastts = pred; } else { - ast_debug(3, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms); + ast_debug(3, "Difference is %d, ms is %u\n", abs(rtp->lastts - pred), ms); mark = 1; } } @@ -2710,7 +2710,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame rtp->lastts = pred; rtp->lastovidtimestamp += frame->samples; } else { - ast_debug(3, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, frame->samples); + ast_debug(3, "Difference is %d, ms is %u (%u), pred/ts/samples %u/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, frame->samples); rtp->lastovidtimestamp = rtp->lastts; } } @@ -2724,7 +2724,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame rtp->lastts = pred; rtp->lastotexttimestamp += frame->samples; } else { - ast_debug(3, "Difference is %d, ms is %d, pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, rtp->lastts, pred, frame->samples); + ast_debug(3, "Difference is %d, ms is %u, pred/ts/samples %u/%d/%d\n", abs(rtp->lastts - pred), ms, rtp->lastts, pred, frame->samples); rtp->lastotexttimestamp = rtp->lastts; } } @@ -2789,7 +2789,7 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent RTP packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Sent RTP packet to %s%s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", codec, rtp->seqno, rtp->lastts, res - hdrlen); @@ -3063,7 +3063,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha samples &= 0xFFFF; if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Got RTP RFC2833 from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", + ast_verbose("Got RTP RFC2833 from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6d, mark %d, event %08x, end %d, duration %-5.5u) \n", ast_sockaddr_stringify(&remote_address), payloadtype, seqno, timestamp, len, (mark?1:0), event, ((event_end & 0x80)?1:0), samples); } @@ -3123,7 +3123,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha rtp->dtmf_duration = rtp->dtmf_timeout = 0; AST_LIST_INSERT_TAIL(frames, f, frame_list); } else if (rtpdebug) { - ast_debug(1, "Dropping re-transmitted, duplicate, or out of order DTMF END frame (seqno: %d, ts %d, digit %c)\n", + ast_debug(1, "Dropping re-transmitted, duplicate, or out of order DTMF END frame (seqno: %u, ts %u, digit %c)\n", seqno, timestamp, resp); } } else { @@ -3140,7 +3140,7 @@ static void process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned cha * this. */ if (rtpdebug) { - ast_debug(1, "Dropping out of order DTMF frame (seqno %d, ts %d, digit %c)\n", + ast_debug(1, "Dropping out of order DTMF frame (seqno %u, ts %u, digit %c)\n", seqno, timestamp, resp); } return; @@ -3225,7 +3225,7 @@ static struct ast_frame *process_dtmf_cisco(struct ast_rtp_instance *instance, u event = data[3] & 0x1f; if (rtpdebug) - ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2); + ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%u, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2); if (event < 10) { resp = '0' + event; } else if (event < 11) { @@ -3452,8 +3452,8 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance) rtp->rtcp->rtt_count++; } else if (rtcp_debug_test_addr(&addr)) { ast_verbose("Internal RTCP NTP clock skew detected: " - "lsr=%u, now=%u, dlsr=%u (%d:%03dms), " - "diff=%d\n", + "lsr=%u, now=%u, dlsr=%u (%u:%03ums), " + "diff=%u\n", lsr, comp, dlsr, dlsr / 65536, (dlsr % 65536) * 1000 / 65536, dlsr - (comp - lsr)); @@ -3501,7 +3501,7 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance) if (rtcp_debug_test_addr(&addr)) { ast_verbose(" Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24)); - ast_verbose(" Packets lost so far: %d\n", rtp->rtcp->reported_lost); + ast_verbose(" Packets lost so far: %u\n", rtp->rtcp->reported_lost); ast_verbose(" Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff)); ast_verbose(" Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2])) >> 16); ast_verbose(" Interarrival jitter: %u\n", rtp->rtcp->reported_jitter); @@ -3516,7 +3516,7 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance) "ReceptionReports: %d\r\n" "SenderSSRC: %u\r\n" "FractionLost: %ld\r\n" - "PacketsLost: %d\r\n" + "PacketsLost: %u\r\n" "HighestSequence: %ld\r\n" "SequenceNumberCycles: %ld\r\n" "IAJitter: %u\r\n" @@ -3541,7 +3541,7 @@ static struct ast_frame *ast_rtcp_read(struct ast_rtp_instance *instance) "ReceptionReports: %d\r\n" "SenderSSRC: %u\r\n" "FractionLost: %ld\r\n" - "PacketsLost: %d\r\n" + "PacketsLost: %u\r\n" "HighestSequence: %ld\r\n" "SequenceNumberCycles: %ld\r\n" "IAJitter: %u\r\n" @@ -3670,7 +3670,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent RTP P2P packet to %s%s (type %-2.2d, len %-6.6u)\n", + ast_verbose("Sent RTP P2P packet to %s%s (type %-2.2d, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", bridged_payload, len - hdrlen); @@ -3879,7 +3879,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc hdrlen += (ntohl(rtpheader[hdrlen/4]) & 0xffff) << 2; hdrlen += 4; if (option_debug) { - int profile; + unsigned int profile; profile = (ntohl(rtpheader[3]) & 0xffff0000) >> 16; if (profile == 0x505a) ast_debug(1, "Found Zfone extension in RTP stream - zrtp - not supported.\n"); @@ -3920,7 +3920,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc } if (rtp_debug_test_addr(&addr)) { - ast_verbose("Got RTP packet from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Got RTP packet from %s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&addr), payloadtype, seqno, timestamp,res - hdrlen); } @@ -4426,7 +4426,7 @@ static int ast_rtp_sendcng(struct ast_rtp_instance *instance, int level) #endif if (rtp_debug_test_addr(&remote_address)) { - ast_verbose("Sent Comfort Noise RTP packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", + ast_verbose("Sent Comfort Noise RTP packet to %s%s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "", AST_RTP_CN, rtp->seqno, rtp->lastdigitts, res - hdrlen); diff --git a/res/res_srtp.c b/res/res_srtp.c index 41241d0ed9..48c69a3e57 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -270,7 +270,7 @@ static int policy_set_suite(crypto_policy_t *p, enum ast_srtp_suite suite) return 0; default: - ast_log(LOG_ERROR, "Invalid crypto suite: %d\n", suite); + ast_log(LOG_ERROR, "Invalid crypto suite: %u\n", suite); return -1; } } @@ -495,18 +495,18 @@ static int ast_srtp_add_stream(struct ast_srtp *srtp, struct ast_srtp_policy *po return -1; } else { if (srtp_remove_stream(srtp->session, match->sp.ssrc.value) != err_status_ok) { - ast_log(AST_LOG_WARNING, "Failed to remove SRTP stream for SSRC %d\n", match->sp.ssrc.value); + ast_log(AST_LOG_WARNING, "Failed to remove SRTP stream for SSRC %u\n", match->sp.ssrc.value); } ao2_t_unlink(srtp->policies, match, "Remove existing match policy"); ao2_t_ref(match, -1, "Unreffing already existing policy"); } } - ast_debug(3, "Adding new policy for %s %d\n", + ast_debug(3, "Adding new policy for %s %u\n", policy->sp.ssrc.type == ssrc_specific ? "SSRC" : "type", policy->sp.ssrc.type == ssrc_specific ? policy->sp.ssrc.value : policy->sp.ssrc.type); if (srtp_add_stream(srtp->session, &policy->sp) != err_status_ok) { - ast_log(AST_LOG_WARNING, "Failed to add SRTP stream for %s %d\n", + ast_log(AST_LOG_WARNING, "Failed to add SRTP stream for %s %u\n", policy->sp.ssrc.type == ssrc_specific ? "SSRC" : "type", policy->sp.ssrc.type == ssrc_specific ? policy->sp.ssrc.value : policy->sp.ssrc.type); return -1; @@ -534,7 +534,7 @@ static int ast_srtp_change_source(struct ast_srtp *srtp, unsigned int from_ssrc, if (ast_srtp_add_stream(srtp, match)) { ast_log(LOG_WARNING, "Couldn't add stream\n"); } else if ((status = srtp_remove_stream(srtp->session, from_ssrc))) { - ast_debug(3, "Couldn't remove stream (%d)\n", status); + ast_debug(3, "Couldn't remove stream (%u)\n", status); } ao2_t_ref(match, -1, "Unreffing found policy in change_source"); } diff --git a/res/res_stun_monitor.c b/res/res_stun_monitor.c index 5530839045..596b17b1dc 100644 --- a/res/res_stun_monitor.c +++ b/res/res_stun_monitor.c @@ -358,7 +358,7 @@ static void _stun_show_status(int fd) { const char *status; -#define DATALN "%-25s %-5d %-7d %-8d %-7s %-16s %-d\n" +#define DATALN "%-25s %-5u %-7u %-8d %-7s %-16s %-d\n" #define HEADER "%-25s %-5s %-7s %-8s %-7s %-16s %-s\n" /*! we only have one stun server, but start to play well with more */ diff --git a/res/res_timing_dahdi.c b/res/res_timing_dahdi.c index 6298253b77..5a67f4d861 100644 --- a/res/res_timing_dahdi.c +++ b/res/res_timing_dahdi.c @@ -79,11 +79,9 @@ static void dahdi_timer_close(int handle) static int dahdi_timer_set_rate(int handle, unsigned int rate) { - int samples; - /* DAHDI timers are configured using a number of samples, * based on an 8 kHz sample rate. */ - samples = (unsigned int) roundf((8000.0 / ((float) rate))); + unsigned int samples = roundf((8000.0 / ((float) rate))); if (ioctl(handle, DAHDI_TIMERCONFIG, &samples)) { ast_log(LOG_ERROR, "Failed to configure DAHDI timing fd for %u sample timer ticks\n", diff --git a/res/res_xmpp.c b/res/res_xmpp.c index a011d5e5ff..13814050c2 100644 --- a/res/res_xmpp.c +++ b/res/res_xmpp.c @@ -1198,9 +1198,9 @@ static void xmpp_pubsub_mwi_cb(const struct ast_event *ast_event, void *data) mailbox = ast_event_get_ie_str(ast_event, AST_EVENT_IE_MAILBOX); context = ast_event_get_ie_str(ast_event, AST_EVENT_IE_CONTEXT); - snprintf(oldmsgs, sizeof(oldmsgs), "%d", + snprintf(oldmsgs, sizeof(oldmsgs), "%u", ast_event_get_ie_uint(ast_event, AST_EVENT_IE_OLDMSGS)); - snprintf(newmsgs, sizeof(newmsgs), "%d", + snprintf(newmsgs, sizeof(newmsgs), "%u", ast_event_get_ie_uint(ast_event, AST_EVENT_IE_NEWMSGS)); xmpp_pubsub_publish_mwi(client, mailbox, context, oldmsgs, newmsgs); } @@ -1329,7 +1329,7 @@ static int xmpp_pubsub_handle_event(void *data, ikspak *pak) } if (!strcasecmp(iks_name(item_content), "state")) { if ((cachable_str = iks_find_attrib(item_content, "cachable"))) { - sscanf(cachable_str, "%30d", &cachable); + sscanf(cachable_str, "%30u", &cachable); } device_state = iks_find_cdata(item, "state"); if (!(event = ast_event_new(AST_EVENT_DEVICE_STATE_CHANGE, @@ -3247,7 +3247,7 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli } manager_event(EVENT_FLAG_USER, "JabberStatus", - "Account: %s\r\nJID: %s\r\nStatus: %d\r\n", + "Account: %s\r\nJID: %s\r\nStatus: %u\r\n", client->name, pak->from->partial, pak->show ? pak->show : IKS_SHOW_UNAVAILABLE); }