From 8634ef9e4a57d128a295f1f114d2c97c32fa400c Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" <kpfleming@digium.com> Date: Fri, 29 Apr 2005 17:00:33 +0000 Subject: [PATCH] don't use '%i' at all, since we have no current use cases that need non base-10 parsing (bug #4110) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5533 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- acl.c | 2 +- app.c | 4 ++-- apps/app_dial.c | 2 +- apps/app_disa.c | 4 ++-- apps/app_groupcount.c | 2 +- apps/app_meetme.c | 18 +++++++++--------- apps/app_osplookup.c | 4 ++-- apps/app_read.c | 2 +- apps/app_readfile.c | 2 +- apps/app_realtime.c | 2 +- apps/app_rpt.c | 2 +- apps/app_voicemail.c | 8 ++++---- cdr/cdr_pgsql.c | 2 +- cdr/cdr_tds.c | 4 ++-- channel.c | 2 +- channels/chan_h323.c | 2 +- channels/chan_iax2.c | 4 ++-- channels/chan_mgcp.c | 4 ++-- channels/chan_phone.c | 2 +- channels/chan_sip.c | 20 ++++++++++---------- channels/chan_skinny.c | 2 +- channels/chan_zap.c | 6 +++--- channels/iax2-provision.c | 4 ++-- cli.c | 2 +- manager.c | 4 ++-- pbx.c | 4 ++-- pbx/pbx_config.c | 4 ++-- pbx/pbx_dundi.c | 8 ++++---- pbx/pbx_loopback.c | 2 +- res/res_features.c | 2 +- res/res_osp.c | 8 ++++---- 31 files changed, 69 insertions(+), 69 deletions(-) diff --git a/acl.c b/acl.c index 47edeb0f2b..6e8c553c09 100755 --- a/acl.c +++ b/acl.c @@ -150,7 +150,7 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path) nm++; } if (!strchr(nm, '.')) { - if ((sscanf(nm, "%i", &x) == 1) && (x >= 0) && (x <= 32)) { + if ((sscanf(nm, "%d", &x) == 1) && (x >= 0) && (x <= 32)) { y = 0; for (z=0;z<x;z++) { y >>= 1; diff --git a/app.c b/app.c index f119f990a0..bc16d6ee58 100755 --- a/app.c +++ b/app.c @@ -571,7 +571,7 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch end=start; /* pre-initialize end to be same as start in case we never get into loop */ for (x=0;x<fmtcnt;x++) { others[x] = ast_writefile(recordfile, sfmt[x], comment, O_TRUNC, 0, 0700); - ast_verbose( VERBOSE_PREFIX_3 "x=%i, open writing: %s format: %s, %p\n", x, recordfile, sfmt[x], others[x]); + ast_verbose( VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, recordfile, sfmt[x], others[x]); if (!others[x]) { break; @@ -793,7 +793,7 @@ int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordf end=start; /* pre-initialize end to be same as start in case we never get into loop */ for (x=0;x<fmtcnt;x++) { others[x] = ast_writefile(prependfile, sfmt[x], comment, O_TRUNC, 0, 0700); - ast_verbose( VERBOSE_PREFIX_3 "x=%i, open writing: %s format: %s, %p\n", x, prependfile, sfmt[x], others[x]); + ast_verbose( VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, prependfile, sfmt[x], others[x]); if (!others[x]) { break; } diff --git a/apps/app_dial.c b/apps/app_dial.c index d5b46dfd1e..6855ac33e4 100755 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -693,7 +693,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags if ((cdl = strstr(transfer, "S("))) { calldurationlimit=atoi(cdl+2); if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %i seconds.\n",calldurationlimit); + ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n",calldurationlimit); } /* Extract DTMF strings to send upon successfull connect */ diff --git a/apps/app_disa.c b/apps/app_disa.c index 0eaf468ec3..ee5985649e 100755 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -143,8 +143,8 @@ static int disa_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "disa requires an argument (passcode/passcode file)\n"); return -1; } - ast_log(LOG_DEBUG, "Digittimeout: %i\n", digittimeout); - ast_log(LOG_DEBUG, "Responsetimeout: %i\n", firstdigittimeout); + ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout); + ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout); strncpy(tmp, (char *)data, sizeof(tmp)-1); stringp=tmp; strsep(&stringp, "|"); diff --git a/apps/app_groupcount.c b/apps/app_groupcount.c index 2c6bacf007..f0c86c4d15 100755 --- a/apps/app_groupcount.c +++ b/apps/app_groupcount.c @@ -114,7 +114,7 @@ static int group_check_exec(struct ast_channel *chan, void *data) ast_app_group_split_group(data, limit, sizeof(limit), category, sizeof(category)); - if ((sscanf(limit, "%i", &max) == 1) && (max > -1)) { + if ((sscanf(limit, "%d", &max) == 1) && (max > -1)) { count = ast_app_group_get_count(pbx_builtin_getvar_helper(chan, category), category); if (count > max) { if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num)) diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 35386f96ab..2e8d3d0e17 100755 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -464,7 +464,7 @@ static int conf_cmd(int fd, int argc, char **argv) { /* Show all the users */ user = cnf->firstuser; while(user) { - ast_cli(fd, "User #: %i Channel: %s %s %s %s %s\n", user->user_no, user->chan->name, (user->userflags & CONFFLAG_ADMIN) ? "(Admin)" : "", (user->userflags & CONFFLAG_MONITOR) ? "(Listen only)" : "", (user->adminflags & ADMINFLAG_MUTED) ? "(Admn Muted)" : "", istalking(user->talking)); + ast_cli(fd, "User #: %d Channel: %s %s %s %s %s\n", user->user_no, user->chan->name, (user->userflags & CONFFLAG_ADMIN) ? "(Admin)" : "", (user->userflags & CONFFLAG_MONITOR) ? "(Listen only)" : "", (user->adminflags & ADMINFLAG_MUTED) ? "(Admn Muted)" : "", istalking(user->talking)); user = user->nextuser; } ast_cli(fd,"%d users in that conference.\n",cnf->users); @@ -535,7 +535,7 @@ static char *complete_confcmd(char *line, char *word, int pos, int state) { /* Search for the user */ usr = cnf->firstuser; while(usr) { - snprintf(usrno, sizeof(usrno), "%i", usr->user_no); + snprintf(usrno, sizeof(usrno), "%d", usr->user_no); if (!strncasecmp(word, usrno, strlen(word))) { if (++which > state) break; @@ -839,7 +839,7 @@ zapretry: "Channel: %s\r\n" "Uniqueid: %s\r\n" "Meetme: %s\r\n" - "Usernum: %i\r\n", + "Usernum: %d\r\n", chan->name, chan->uniqueid, conf->confno, user->user_no); if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) { @@ -1047,7 +1047,7 @@ zapretry: "Channel: %s\r\n" "Uniqueid: %s\r\n" "Meetme: %s\r\n" - "Usernum: %i\r\n", + "Usernum: %d\r\n", chan->name, chan->uniqueid, conf->confno, user->user_no); } if (user->talking && totalsilence > MEETME_DELAYDETECTENDTALK) { @@ -1056,7 +1056,7 @@ zapretry: "Channel: %s\r\n" "Uniqueid: %s\r\n" "Meetme: %s\r\n" - "Usernum: %i\r\n", + "Usernum: %d\r\n", chan->name, chan->uniqueid, conf->confno, user->user_no); } } @@ -1273,7 +1273,7 @@ outrun: "Channel: %s\r\n" "Uniqueid: %s\r\n" "Meetme: %s\r\n" - "Usernum: %i\r\n", + "Usernum: %d\r\n", chan->name, chan->uniqueid, conf->confno, user->user_no); prev = NULL; conf->users--; @@ -1340,7 +1340,7 @@ outrun: } } /* Return the number of seconds the user was in the conf */ - snprintf(meetmesecs, sizeof(meetmesecs), "%i", (int) (time(NULL) - user->jointime)); + snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime)); pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs); } free(user); @@ -1451,7 +1451,7 @@ static int count_exec(struct ast_channel *chan, void *data) if (localdata && !ast_strlen_zero(localdata)){ /* have var so load it and exit */ - snprintf(val,sizeof(val), "%i",count); + snprintf(val,sizeof(val), "%d",count); pbx_builtin_setvar_helper(chan, localdata,val); } else { if (chan->_state != AST_STATE_UP) @@ -1706,7 +1706,7 @@ static struct ast_conf_user* find_user(struct ast_conference *conf, char *caller if (conf && callerident) { user = conf->firstuser; while(user) { - snprintf(usrno, sizeof(usrno), "%i", user->user_no); + snprintf(usrno, sizeof(usrno), "%d", user->user_no); if (strcmp(usrno, callerident) == 0) return user; user = user->nextuser; diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 0c58dd63a4..de08e44694 100755 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -150,7 +150,7 @@ static int ospnext_exec(struct ast_channel *chan, void *data) cause = str2cause((char *)data); temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE"); result.handle = -1; - if (temp && strlen(temp) && (sscanf(temp, "%i", &result.handle) == 1) && (result.handle > -1)) { + if (temp && strlen(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) { if ((res = ast_osp_next(&result, cause)) > 0) { char tmp[80]; snprintf(tmp, sizeof(tmp), "%d", result.handle); @@ -203,7 +203,7 @@ static int ospfinished_exec(struct ast_channel *chan, void *data) cause = str2cause((char *)data); temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE"); result.handle = -1; - if (temp && strlen(temp) && (sscanf(temp, "%i", &result.handle) == 1) && (result.handle > -1)) { + if (temp && strlen(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) { if (!ast_osp_terminate(result.handle, cause, start, duration)) { pbx_builtin_setvar_helper(chan, "_OSPHANDLE", ""); res = 1; diff --git a/apps/app_read.c b/apps/app_read.c index eaff923e9a..d561c34d44 100755 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -119,7 +119,7 @@ static int read_exec(struct ast_channel *chan, void *data) if ((maxdigits<1) || (maxdigits>255)) { maxdigits = 255; } else if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Accepting a maximum of %i digits.\n", maxdigits); + ast_verbose(VERBOSE_PREFIX_3 "Accepting a maximum of %d digits.\n", maxdigits); } if (!(varname) || ast_strlen_zero(varname)) { ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n"); diff --git a/apps/app_readfile.c b/apps/app_readfile.c index 92815472bb..0cff0a3276 100755 --- a/apps/app_readfile.c +++ b/apps/app_readfile.c @@ -78,7 +78,7 @@ static int readfile_exec(struct ast_channel *chan, void *data) if(len < strlen(returnvar)) returnvar[len]='\0'; else - ast_log(LOG_WARNING,"%s is longer than %i, and %i \n",file,len,strlen(returnvar)); + ast_log(LOG_WARNING,"%s is longer than %d, and %d \n",file,len,strlen(returnvar)); } pbx_builtin_setvar_helper(chan, varname, returnvar); free(returnvar); diff --git a/apps/app_realtime.c b/apps/app_realtime.c index 7a1a63d4a5..6ae64f5c4d 100755 --- a/apps/app_realtime.c +++ b/apps/app_realtime.c @@ -87,7 +87,7 @@ static int cli_update_realtime(int fd, int argc, char **argv) { return RESULT_SUCCESS; } - ast_cli(fd, "Updated %i RealTime record(s).\n", res); + ast_cli(fd, "Updated %d RealTime record(s).\n", res); return RESULT_SUCCESS; } diff --git a/apps/app_rpt.c b/apps/app_rpt.c index b04c8489ba..2595bbbd78 100755 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -347,7 +347,7 @@ static int myatoi(char *str) int ret; if (str == NULL) return -1; - if (sscanf(str,"%i",&ret) != 1) return -1; + if (sscanf(str,"%d",&ret) != 1) return -1; return ret; } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index fedfd12713..b3fb4f9ccd 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -859,7 +859,7 @@ static int last_message_index(char *dir) SQLFreeHandle (SQL_HANDLE_STMT, stmt); goto yuck; } - if (sscanf(rowdata, "%i", &x) != 1) + if (sscanf(rowdata, "%d", &x) != 1) ast_log(LOG_WARNING, "Failed to read message count!\n"); SQLFreeHandle (SQL_HANDLE_STMT, stmt); } else @@ -920,7 +920,7 @@ static int message_exists(char *dir, int msgnum) SQLFreeHandle (SQL_HANDLE_STMT, stmt); goto yuck; } - if (sscanf(rowdata, "%i", &x) != 1) + if (sscanf(rowdata, "%d", &x) != 1) ast_log(LOG_WARNING, "Failed to read message count!\n"); SQLFreeHandle (SQL_HANDLE_STMT, stmt); } else @@ -4072,7 +4072,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_change_password(vmu,newpassword); else vm_change_password_shell(vmu,newpassword); - ast_log(LOG_DEBUG,"User %s set password to %s of length %i\n",vms->username,newpassword,(int)strlen(newpassword)); + ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword)); cmd = ast_play_and_wait(chan,"vm-passchanged"); /* If forcename is set, have the user record their name */ @@ -4174,7 +4174,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_change_password(vmu,newpassword); else vm_change_password_shell(vmu,newpassword); - ast_log(LOG_DEBUG,"User %s set password to %s of length %i\n",vms->username,newpassword,(int)strlen(newpassword)); + ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword)); cmd = ast_play_and_wait(chan,"vm-passchanged"); break; case '*': diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index 5aa2430a2f..2cff8f3148 100755 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -101,7 +101,7 @@ static int pgsql_log(struct ast_cdr *cdr) snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel," "lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES" - " ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s','%s')", + " ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%d,%d,'%s',%d,'%s','%s','%s')", table,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata, cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfield); diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c index 5e99529f6c..59076a25bc 100755 --- a/cdr/cdr_tds.c +++ b/cdr/cdr_tds.c @@ -147,8 +147,8 @@ static int tds_log(struct ast_cdr *cdr) "%s, " /* start */ "%s, " /* answer */ "%s, " /* end */ - "%i, " /* duration */ - "%i, " /* billsec */ + "%d, " /* duration */ + "%d, " /* billsec */ "'%s', " /* disposition */ "'%s', " /* amaflags */ "'%s'" /* uniqueid */ diff --git a/channel.c b/channel.c index 5eb680d020..4e9b9320ad 100755 --- a/channel.c +++ b/channel.c @@ -854,7 +854,7 @@ int ast_hangup(struct ast_channel *chan) manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n" "Uniqueid: %s\r\n" - "Cause: %i\r\n", + "Cause: %d\r\n", chan->name, chan->uniqueid, chan->hangupcause); ast_channel_free(chan); return res; diff --git a/channels/chan_h323.c b/channels/chan_h323.c index d27e8169ad..c14b0d4b1d 100755 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -1996,7 +1996,7 @@ int reload_config(void) else capability &= ~format; } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &format)) { + if (sscanf(v->value, "%d", &format)) { tos = format & 0xff; } else if (!strcasecmp(v->value, "lowdelay")) { tos = IPTOS_LOWDELAY; diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 50fcaeb438..d3740b6ddf 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -8360,7 +8360,7 @@ static int set_config(char *config_file, int reload) if (trunkfreq < 10) trunkfreq = 10; } else if (!strcasecmp(v->name, "autokill")) { - if (sscanf(v->value, "%i", &x) == 1) { + if (sscanf(v->value, "%d", &x) == 1) { if (x >= 0) autokill = x; else @@ -8393,7 +8393,7 @@ static int set_config(char *config_file, int reload) if (!ast_context_find(regcontext)) ast_context_create(NULL, regcontext, channeltype); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &format) == 1) + if (sscanf(v->value, "%d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 78f7d37493..0bddcafc77 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -4132,7 +4132,7 @@ static int reload_config(void) else capability &= ~format; } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &format) == 1) + if (sscanf(v->value, "%d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; @@ -4147,7 +4147,7 @@ static int reload_config(void) else ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno); } else if (!strcasecmp(v->name, "port")) { - if (sscanf(v->value, "%i", &ourport) == 1) { + if (sscanf(v->value, "%d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 20290aba00..dd8aa6501c 100755 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -219,7 +219,7 @@ static int phone_digit(struct ast_channel *ast, char digit) ast_log(LOG_WARNING, "Unknown digit '%c'\n", digit); return -1; } - ast_log(LOG_NOTICE, "Dialed %i\n", outdigit); + ast_log(LOG_NOTICE, "Dialed %d\n", outdigit); ioctl(p->fd, PHONE_PLAY_TONE, outdigit); p->lastformat = -1; return 0; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 24cc457a6a..8b620fbaa8 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1630,7 +1630,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout) res = 0; ast_set_flag(p, SIP_OUTGOING); #ifdef OSP_SUPPORT - if (!osptoken || !osphandle || (sscanf(osphandle, "%i", &p->osphandle) != 1)) { + if (!osptoken || !osphandle || (sscanf(osphandle, "%d", &p->osphandle) != 1)) { /* Force Disable OSP support */ ast_log(LOG_DEBUG, "Disabling OSP support for this call. osptoken = %s, osphandle = %s\n", osptoken, osphandle); osptoken = NULL; @@ -3510,7 +3510,7 @@ static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request struct sip_request resp; int seqno = 0; - if (reliable && (sscanf(get_header(req, "CSeq"), "%i ", &seqno) != 1)) { + if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) { ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -3574,7 +3574,7 @@ static int transmit_response_with_auth(struct sip_pvt *p, char *msg, struct sip_ char tmp[256]; int seqno = 0; - if (reliable && (sscanf(get_header(req, "CSeq"), "%i ", &seqno) != 1)) { + if (reliable && (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1)) { ast_log(LOG_WARNING, "Unable to determine sequence number from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -3825,7 +3825,7 @@ static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_r { struct sip_request resp; int seqno; - if (sscanf(get_header(req, "CSeq"), "%i ", &seqno) != 1) { + if (sscanf(get_header(req, "CSeq"), "%d ", &seqno) != 1) { ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq")); return -1; } @@ -8858,7 +8858,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc /* Must have Cseq */ if (ast_strlen_zero(cmd) || ast_strlen_zero(cseq)) return -1; - if (sscanf(cseq, "%i%n", &seqno, &len) != 1) { + if (sscanf(cseq, "%d%n", &seqno, &len) != 1) { ast_log(LOG_DEBUG, "No seqno in '%s'\n", cmd); return -1; } @@ -8897,7 +8897,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc extract_uri(p, req); while(*e && (*e < 33)) e++; - if (sscanf(e, "%i %n", &respid, &len) != 1) { + if (sscanf(e, "%d %n", &respid, &len) != 1) { ast_log(LOG_WARNING, "Invalid response: '%s'\n", e); } else { handle_response(p, respid, e + len, req,ignore, seqno); @@ -10250,7 +10250,7 @@ static int reload_config(void) ast_log(LOG_WARNING, "Unable to locate host '%s'\n", v->value); } else if (!strcasecmp(v->name, "outboundproxyport")) { /* Port needs to be after IP */ - sscanf(v->value, "%i", &format); + sscanf(v->value, "%d", &format); outboundproxyip.sin_port = htons(format); } else if (!strcasecmp(v->name, "autocreatepeer")) { autocreatepeer = ast_true(v->value); @@ -10298,7 +10298,7 @@ static int reload_config(void) memcpy(&externip.sin_addr, hp->h_addr, sizeof(externip.sin_addr)); time(&externexpire); } else if (!strcasecmp(v->name, "externrefresh")) { - if (sscanf(v->value, "%i", &externrefresh) != 1) { + if (sscanf(v->value, "%d", &externrefresh) != 1) { ast_log(LOG_WARNING, "Invalid externrefresh value '%s', must be an integer >0 at line %d\n", v->value, v->lineno); externrefresh = 10; } @@ -10311,7 +10311,7 @@ static int reload_config(void) } else if (!strcasecmp(v->name, "recordhistory")) { recordhistory = ast_true(v->value); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &format) == 1) + if (sscanf(v->value, "%d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; @@ -10326,7 +10326,7 @@ static int reload_config(void) else ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno); } else if (!strcasecmp(v->name, "bindport")) { - if (sscanf(v->value, "%i", &ourport) == 1) { + if (sscanf(v->value, "%d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index bbb336c475..6b9f4b8544 100755 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2888,7 +2888,7 @@ static int reload_config(void) else capability &= ~format; } else if (!strcasecmp(v->name, "port")) { - if (sscanf(v->value, "%i", &ourport) == 1) { + if (sscanf(v->value, "%d", &ourport) == 1) { bindaddr.sin_port = htons(ourport); } else { ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config); diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 09c7b1df72..946eac569e 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -8331,7 +8331,7 @@ static void *pri_dchannel(void *vpri) } if (e->hangup.aoc_units > -1) if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %i unit%s\n", + ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s"); ast_mutex_unlock(&pri->pvts[chanpos]->lock); } else { @@ -8377,7 +8377,7 @@ static void *pri_dchannel(void *vpri) ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span); if (e->hangup.aoc_units > -1) if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %i unit%s\n", + ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d received AOC-E charging %d unit%s\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span, (int)e->hangup.aoc_units, (e->hangup.aoc_units == 1) ? "" : "s"); } else { pri_hangup(pri->pri, pri->pvts[chanpos]->call, e->hangup.cause); @@ -9771,7 +9771,7 @@ static int setup_zap(int reload) echocancel=128; } } else if (!strcasecmp(v->name, "echotraining")) { - if (sscanf(v->value, "%i", &y) == 1) { + if (sscanf(v->value, "%d", &y) == 1) { if ((y < 10) || (y > 4000)) { ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 2000 ms at line %d\n", v->lineno); } else { diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c index 5feec89a7a..f44dcba8c9 100755 --- a/channels/iax2-provision.c +++ b/channels/iax2-provision.c @@ -287,7 +287,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg, v = ast_variable_browse(cfg, s); while(v) { if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x > 0) && (x < 65535)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < 65535)) { if (!strcasecmp(v->name, "port")) { cur->port = x; foundportno = 1; @@ -313,7 +313,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg, } else ast_log(LOG_WARNING, "Ignoring invalid codec '%s' for '%s' at line %d\n", v->value, s, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &x) == 1) + if (sscanf(v->value, "%d", &x) == 1) cur->tos = x & 0xff; else if (!strcasecmp(v->value, "lowdelay")) cur->tos = IPTOS_LOWDELAY; diff --git a/cli.c b/cli.c index eceef43c19..f5865cc1e6 100755 --- a/cli.c +++ b/cli.c @@ -583,7 +583,7 @@ static int handle_debuglevel(int fd, int argc, char *argv[]) char *filename = "<any>"; if ((argc < 3) || (argc > 4)) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%i", &newlevel) != 1) + if (sscanf(argv[2], "%d", &newlevel) != 1) return RESULT_SHOWUSAGE; option_debug = newlevel; if (argc == 4) { diff --git a/manager.c b/manager.c index eb4d22937d..8b8c66bb17 100755 --- a/manager.c +++ b/manager.c @@ -896,7 +896,7 @@ static void *fast_originate(void *data) "Channel: %s/%s\r\n" "Context: %s\r\n" "Exten: %s\r\n" - "Reason: %i\r\n" + "Reason: %d\r\n" "Uniqueid: %s\r\n", in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "<null>"); else @@ -906,7 +906,7 @@ static void *fast_originate(void *data) "Channel: %s/%s\r\n" "Context: %s\r\n" "Exten: %s\r\n" - "Reason: %i\r\n" + "Reason: %d\r\n" "Uniqueid: %s\r\n", in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "<null>"); diff --git a/pbx.c b/pbx.c index 79a903480f..68c0a55eb8 100755 --- a/pbx.c +++ b/pbx.c @@ -1057,7 +1057,7 @@ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, c snprintf(workspace, workspacelen, "%s", c->uniqueid); *ret = workspace; } else if (c && !strcmp(var, "HANGUPCAUSE")) { - snprintf(workspace, workspacelen, "%i", c->hangupcause); + snprintf(workspace, workspacelen, "%d", c->hangupcause); *ret = workspace; } else if (c && !strcmp(var, "ACCOUNTCODE")) { strncpy(workspace, c->accountcode, workspacelen - 1); @@ -5261,7 +5261,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data) struct ast_frame *f; int waittime; - if (!data || !strlen(data) || (sscanf(data, "%i", &waittime) != 1) || (waittime < 0)) + if (!data || !strlen(data) || (sscanf(data, "%d", &waittime) != 1) || (waittime < 0)) waittime = -1; if (waittime > -1) { ast_safe_sleep(chan, waittime * 1000); diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 33a669396e..a2056e7842 100755 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1191,7 +1191,7 @@ static int handle_context_add_extension(int fd, int argc, char *argv[]) if (!strcmp(prior, "hint")) { iprior = PRIORITY_HINT; } else { - if (sscanf(prior, "%i", &iprior) != 1) { + if (sscanf(prior, "%d", &iprior) != 1) { ast_cli(fd, "'%s' is not a valid priority\n", prior); prior = NULL; } @@ -1700,7 +1700,7 @@ static int pbx_load_module(void) else ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n"); } else { - if (sscanf(pri, "%i", &ipri) != 1) { + if (sscanf(pri, "%d", &ipri) != 1) { if ((ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) { ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno); ipri = 0; diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index b80867b29e..ca3c4441af 100755 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -4059,7 +4059,7 @@ static void build_mapping(char *name, char *value) } else if (x >= 4) { strncpy(map->dcontext, name, sizeof(map->dcontext) - 1); strncpy(map->lcontext, fields[0], sizeof(map->lcontext) - 1); - if ((sscanf(fields[1], "%i", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { + if ((sscanf(fields[1], "%d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { strncpy(map->dest, fields[3], sizeof(map->dest) - 1); if ((map->tech = str2tech(fields[2]))) { map->dead = 0; @@ -4502,14 +4502,14 @@ static int set_config(char *config_file, struct sockaddr_in* sin) } else if (!strcasecmp(v->name, "authdebug")) { authdebug = ast_true(v->value); } else if (!strcasecmp(v->name, "ttl")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) { dundi_ttl = x; } else { ast_log(LOG_WARNING, "'%s' is not a valid TTL at line %d, must be number from 1 to %d\n", v->value, v->lineno, DUNDI_DEFAULT_TTL); } } else if (!strcasecmp(v->name, "autokill")) { - if (sscanf(v->value, "%i", &x) == 1) { + if (sscanf(v->value, "%d", &x) == 1) { if (x >= 0) global_autokilltimeout = x; else @@ -4525,7 +4525,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) else ast_log(LOG_WARNING, "Invalid global endpoint identifier '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%i", &format) == 1) + if (sscanf(v->value, "%d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c index 8fb7b3f7eb..065cac855f 100755 --- a/pbx/pbx_loopback.c +++ b/pbx/pbx_loopback.c @@ -108,7 +108,7 @@ static void loopback_subst(char **newexten, char **newcontext, int *priority, ch if (con && !ast_strlen_zero(con)) *newcontext = con; if (pri && !ast_strlen_zero(pri)) - sscanf(pri, "%i", priority); + sscanf(pri, "%d", priority); } static int loopback_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) diff --git a/res/res_features.c b/res/res_features.c index 99874a8b4e..06ff702174 100755 --- a/res/res_features.c +++ b/res/res_features.c @@ -1571,7 +1571,7 @@ static int load_config(void) } else parkingtime = parkingtime * 1000; } else if (!strcasecmp(var->name, "parkpos")) { - if (sscanf(var->value, "%i-%i", &start, &end) != 2) { + if (sscanf(var->value, "%d-%d", &start, &end) != 2) { ast_log(LOG_WARNING, "Format for parking positions is a-b, where a and b are numbers at line %d of parking.conf\n", var->lineno); } else { parking_start = start; diff --git a/res/res_osp.c b/res/res_osp.c index 570df78b1c..e86a2e8810 100755 --- a/res/res_osp.c +++ b/res/res_osp.c @@ -151,22 +151,22 @@ static int osp_build(struct ast_config *cfg, char *cat) } else ast_log(LOG_WARNING, "Too many Service points at line %d\n", v->lineno); } else if (!strcasecmp(v->name, "maxconnections")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x > 0) && (x <= 1000)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x <= 1000)) { osp->maxconnections = x; } else ast_log(LOG_WARNING, "maxconnections should be an integer from 1 to 1000, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "retrydelay")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x >= 0) && (x <= 10)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 10)) { osp->retrydelay = x; } else ast_log(LOG_WARNING, "retrydelay should be an integer from 0 to 10, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "retrylimit")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x >= 0) && (x <= 100)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x >= 0) && (x <= 100)) { osp->retrylimit = x; } else ast_log(LOG_WARNING, "retrylimit should be an integer from 0 to 100, not '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "timeout")) { - if ((sscanf(v->value, "%i", &x) == 1) && (x >= 200) && (x <= 10000)) { + if ((sscanf(v->value, "%d", &x) == 1) && (x >= 200) && (x <= 10000)) { osp->timeout = x; } else ast_log(LOG_WARNING, "timeout should be an integer from 200 to 10000, not '%s' at line %d\n", v->value, v->lineno); -- GitLab