Avoid cppcheck warnings; removing unused vars and a bit of cleanup.

Patch by: Clod Patry
Review: https://reviewboard.asterisk.org/r/1651


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Walter Doekes 14 years ago
parent 0adeb88318
commit db24fc2523

@ -2975,7 +2975,6 @@ static int sdp_search(char *addr, int profile)
static sdp_session_t *sdp_register(void) static sdp_session_t *sdp_register(void)
{ {
uint32_t service_uuid_int[] = {0, 0, 0, GENERIC_AUDIO_SVCLASS_ID}; uint32_t service_uuid_int[] = {0, 0, 0, GENERIC_AUDIO_SVCLASS_ID};
uint8_t rfcomm_channel = 1; uint8_t rfcomm_channel = 1;
const char *service_name = "Asterisk PABX"; const char *service_name = "Asterisk PABX";
@ -3021,8 +3020,12 @@ static sdp_session_t *sdp_register(void)
if (!(session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY))) if (!(session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY)))
ast_log(LOG_WARNING, "Failed to connect sdp and create session.\n"); ast_log(LOG_WARNING, "Failed to connect sdp and create session.\n");
else else {
sdp_record_register(session, record, 0); if (sdp_record_register(session, record, 0) < 0) {
ast_log(LOG_WARNING, "Failed to sdp_record_register error: %d\n", errno);
return NULL;
}
}
sdp_data_free(channel); sdp_data_free(channel);
sdp_list_free(rfcomm_list, 0); sdp_list_free(rfcomm_list, 0);
@ -4083,18 +4086,17 @@ static void *do_discovery(void *data)
static void *do_sco_listen(void *data) static void *do_sco_listen(void *data)
{ {
struct adapter_pvt *adapter = (struct adapter_pvt *) data; struct adapter_pvt *adapter = (struct adapter_pvt *) data;
int res;
while (!check_unloading()) { while (!check_unloading()) {
/* check for new sco connections */ /* check for new sco connections */
if ((res = ast_io_wait(adapter->accept_io, 0)) == -1) { if (ast_io_wait(adapter->accept_io, 0) == -1) {
/* handle errors */ /* handle errors */
ast_log(LOG_ERROR, "ast_io_wait() failed for adapter %s\n", adapter->id); ast_log(LOG_ERROR, "ast_io_wait() failed for adapter %s\n", adapter->id);
break; break;
} }
/* handle audio data */ /* handle audio data */
if ((res = ast_io_wait(adapter->io, 1)) == -1) { if (ast_io_wait(adapter->io, 1) == -1) {
ast_log(LOG_ERROR, "ast_io_wait() failed for audio on adapter %s\n", adapter->id); ast_log(LOG_ERROR, "ast_io_wait() failed for audio on adapter %s\n", adapter->id);
break; break;
} }

@ -3518,7 +3518,6 @@ static int function_ooh323_write(struct ast_channel *chan, const char *cmd, char
static int load_module(void) static int load_module(void)
{ {
int res;
struct ooAliases * pNewAlias = NULL; struct ooAliases * pNewAlias = NULL;
struct ooh323_peer *peer = NULL; struct ooh323_peer *peer = NULL;
struct ast_format tmpfmt; struct ast_format tmpfmt;
@ -3566,7 +3565,7 @@ static int load_module(void)
} }
if (!(res = reload_config(0))) { if (!reload_config(0)) {
/* Make sure we can register our OOH323 channel type */ /* Make sure we can register our OOH323 channel type */
if (ast_channel_register(&ooh323_tech)) { if (ast_channel_register(&ooh323_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type); ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
@ -4186,7 +4185,6 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
/* XXX Deal with Video */ /* XXX Deal with Video */
struct ooh323_pvt *p; struct ooh323_pvt *p;
struct ast_sockaddr tmp; struct ast_sockaddr tmp;
int mode;
if (gH323Debug) if (gH323Debug)
ast_verb(0, "--- ooh323_set_peer - %s\n", ast_channel_name(chan)); ast_verb(0, "--- ooh323_set_peer - %s\n", ast_channel_name(chan));
@ -4195,7 +4193,10 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
return 0; return 0;
} }
mode = ooh323_convertAsteriskCapToH323Cap(&chan->writeformat); if (ooh323_convertAsteriskCapToH323Cap(&chan->writeformat) < 0) {
ast_log(LOG_WARNING, "Unknown format.\n");
return -1;
}
p = (struct ooh323_pvt *) chan->tech_pvt; p = (struct ooh323_pvt *) chan->tech_pvt;
if (!p) { if (!p) {
ast_log(LOG_ERROR, "No Private Structure, this is bad\n"); ast_log(LOG_ERROR, "No Private Structure, this is bad\n");

@ -726,7 +726,7 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
OSMemLink** ppMemLink; OSMemLink** ppMemLink;
OSMemBlk* pMemBlk; OSMemBlk* pMemBlk;
OSMemElemDescr* pElem; OSMemElemDescr* pElem;
OSMemLink* pMemLink, *pPrevMemLink = 0; OSMemLink* pMemLink;
void *newMem_p; void *newMem_p;
unsigned nbytes, nunits; unsigned nbytes, nunits;
@ -758,7 +758,6 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
*(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_; *(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_;
return pMemLink->pMemBlk; return pMemLink->pMemBlk;
} }
pPrevMemLink = pMemLink;
} }
/* Round number of bytes to nearest 8-byte boundary */ /* Round number of bytes to nearest 8-byte boundary */

@ -251,7 +251,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
break; break;
} }
if ((r = ast_waitfor(chan, -1) < 0)) { if ((r = ast_waitfor(chan, -1)) < 0) {
ast_debug(1, "Waitfor returned %d\n", r); ast_debug(1, "Waitfor returned %d\n", r);
continue; continue;
} }

@ -614,7 +614,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
has arrived, since the spied-on channel could have gone away while has arrived, since the spied-on channel could have gone away while
we were waiting we were waiting
*/ */
while ((res = ast_waitfor(chan, -1) > -1) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) { while (ast_waitfor(chan, -1) > -1 && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
if (!(f = ast_read(chan)) || ast_check_hangup(chan)) { if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
running = -1; running = -1;
break; break;
@ -771,7 +771,6 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
int waitms; int waitms;
int res; int res;
char *ptr; char *ptr;
int num;
int num_spyed_upon = 1; int num_spyed_upon = 1;
struct ast_channel_iterator *iter = NULL; struct ast_channel_iterator *iter = NULL;
@ -962,6 +961,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
res = ast_app_sayname(chan, local_mailbox, local_context); res = ast_app_sayname(chan, local_mailbox, local_context);
} }
if (!ast_test_flag(flags, OPTION_NAME) || res < 0) { if (!ast_test_flag(flags, OPTION_NAME) || res < 0) {
int num;
if (!ast_test_flag(flags, OPTION_NOTECH)) { if (!ast_test_flag(flags, OPTION_NOTECH)) {
if (ast_fileexists(peer_name, NULL, NULL) > 0) { if (ast_fileexists(peer_name, NULL, NULL) > 0) {
res = ast_streamfile(chan, peer_name, ast_channel_language(chan)); res = ast_streamfile(chan, peer_name, ast_channel_language(chan));
@ -976,8 +976,9 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
res = ast_say_character_str(chan, peer_name, "", ast_channel_language(chan)); res = ast_say_character_str(chan, peer_name, "", ast_channel_language(chan));
} }
} }
if ((num = atoi(ptr))) if ((num = atoi(ptr))) {
ast_say_digits(chan, atoi(ptr), "", ast_channel_language(chan)); ast_say_digits(chan, num, "", ast_channel_language(chan));
}
} }
} }

@ -1706,7 +1706,6 @@ static int setup_privacy_args(struct privacy_args *pa,
char callerid[60]; char callerid[60];
int res; int res;
char *l; char *l;
int silencethreshold;
if (chan->caller.id.number.valid if (chan->caller.id.number.valid
&& !ast_strlen_zero(chan->caller.id.number.str)) { && !ast_strlen_zero(chan->caller.id.number.str)) {
@ -1781,7 +1780,7 @@ static int setup_privacy_args(struct privacy_args *pa,
"At the tone, please say your name:" "At the tone, please say your name:"
*/ */
silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE); int silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
ast_answer(chan); ast_answer(chan);
res = ast_play_and_record(chan, "priv-recordintro", pa->privintro, 4, "sln", &duration, NULL, silencethreshold, 2000, 0); /* NOTE: I've reduced the total time to 4 sec */ res = ast_play_and_record(chan, "priv-recordintro", pa->privintro, 4, "sln", &duration, NULL, silencethreshold, 2000, 0); /* NOTE: I've reduced the total time to 4 sec */
/* don't think we'll need a lock removed, we took care of /* don't think we'll need a lock removed, we took care of

@ -214,7 +214,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
break; break;
} }
if ((res = ast_waitfor(chan, -1) < 0)) { if ((res = ast_waitfor(chan, -1)) < 0) {
ast_debug(1, "Waitfor returned %d\n", res); ast_debug(1, "Waitfor returned %d\n", res);
continue; continue;
} }

@ -3343,7 +3343,6 @@ static int access_counter_file(char *directory, char *countername, int value, in
static int minivm_counter_func_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) static int minivm_counter_func_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{ {
char *username, *domain, *countername; char *username, *domain, *countername;
struct minivm_account *vmu = NULL;
char userpath[BUFSIZ]; char userpath[BUFSIZ];
int res; int res;
@ -3381,7 +3380,7 @@ static int minivm_counter_func_read(struct ast_channel *chan, const char *cmd, c
} }
/* If we can't find account or if the account is temporary, return. */ /* If we can't find account or if the account is temporary, return. */
if (!ast_strlen_zero(username) && !(vmu = find_account(domain, username, FALSE))) { if (!ast_strlen_zero(username) && !find_account(domain, username, FALSE)) {
ast_log(LOG_ERROR, "Minivm account does not exist: %s@%s\n", username, domain); ast_log(LOG_ERROR, "Minivm account does not exist: %s@%s\n", username, domain);
return 0; return 0;
} }

@ -614,7 +614,6 @@ struct osp_metrics {
float min; /* Minimum */ float min; /* Minimum */
float max; /* Maximum */ float max; /* Maximum */
float avg; /* Average */ float avg; /* Average */
float ndev; /* Normal deviation */
float sdev; /* Standard deviation */ float sdev; /* Standard deviation */
}; };
@ -1452,7 +1451,7 @@ static int osp_create_callid(
if (callid == NULL) { if (callid == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n"); ast_log(LOG_ERROR, "Invalid parameters\n");
res = OSP_ERROR; return OSP_ERROR;
} }
callid->len = sizeof(callid->buf); callid->len = sizeof(callid->buf);
@ -1463,6 +1462,7 @@ static int osp_create_callid(
case OSP_CALLID_SIP: case OSP_CALLID_SIP:
case OSP_CALLID_IAX: case OSP_CALLID_IAX:
res = OSP_FAILED; res = OSP_FAILED;
break;
default: default:
res = OSP_ERROR; res = OSP_ERROR;
break; break;
@ -1529,7 +1529,7 @@ static int osp_lookup(
if (results == NULL) { if (results == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n"); ast_log(LOG_ERROR, "Invalid parameters\n");
res = OSP_ERROR; return OSP_ERROR;
} }
osp_convert_inout(results->dest, dest, sizeof(dest)); osp_convert_inout(results->dest, dest, sizeof(dest));
@ -1787,7 +1787,7 @@ static int osp_lookup(
/*! /*!
* \brief OSP Lookup Next function * \brief OSP Lookup Next function
* \param name OSP provider name * \param name OSP provider name
* \param cause Asterisk hangup cuase * \param cause Asterisk hangup cause
* \param results Lookup results, in/output * \param results Lookup results, in/output
* \return OSP_OK Found , OSP_FAILED No route, OSP_ERROR Error * \return OSP_OK Found , OSP_FAILED No route, OSP_ERROR Error
*/ */
@ -1809,7 +1809,7 @@ static int osp_next(
if (results == NULL) { if (results == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n"); ast_log(LOG_ERROR, "Invalid parameters\n");
res = OSP_ERROR; return OSP_ERROR;
} }
results->outtech[0] = '\0'; results->outtech[0] = '\0';

@ -4860,10 +4860,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
/* Begin Monitoring */ /* Begin Monitoring */
if (qe->parent->monfmt && *qe->parent->monfmt) { if (qe->parent->monfmt && *qe->parent->monfmt) {
if (!qe->parent->montype) { if (!qe->parent->montype) {
const char *monexec, *monargs; const char *monexec;
ast_debug(1, "Starting Monitor as requested.\n"); ast_debug(1, "Starting Monitor as requested.\n");
ast_channel_lock(qe->chan); ast_channel_lock(qe->chan);
if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || (monargs = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS"))) { if ((monexec = pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC")) || pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS")) {
which = qe->chan; which = qe->chan;
monexec = monexec ? ast_strdupa(monexec) : NULL; monexec = monexec ? ast_strdupa(monexec) : NULL;
} }

@ -1949,9 +1949,8 @@ static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_
*vms_p->introfn = '\0'; *vms_p->introfn = '\0';
ast_mutex_lock(&vms_p->lock); ast_mutex_lock(&vms_p->lock);
init_mailstream(vms_p, GREETINGS_FOLDER); if (init_mailstream(vms_p, GREETINGS_FOLDER) || !vms_p->mailstream) {
if (!vms_p->mailstream) { ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL or can't init_mailstream\n");
ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL\n");
ast_mutex_unlock(&vms_p->lock); ast_mutex_unlock(&vms_p->lock);
return -1; return -1;
} }
@ -2570,7 +2569,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
*/ */
static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir, char *flag) static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir, char *flag)
{ {
struct vm_state *sendvms = NULL, *destvms = NULL; struct vm_state *sendvms = NULL;
char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/ char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/
if (msgnum >= recip->maxmsg) { if (msgnum >= recip->maxmsg) {
ast_log(LOG_WARNING, "Unable to copy mail, mailbox %s is full\n", recip->mailbox); ast_log(LOG_WARNING, "Unable to copy mail, mailbox %s is full\n", recip->mailbox);
@ -2580,7 +2579,7 @@ static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int i
ast_log(LOG_ERROR, "Couldn't get vm_state for originator's mailbox!!\n"); ast_log(LOG_ERROR, "Couldn't get vm_state for originator's mailbox!!\n");
return -1; return -1;
} }
if (!(destvms = get_vm_state_by_imapuser(recip->imapuser, 0))) { if (!get_vm_state_by_imapuser(recip->imapuser, 0)) {
ast_log(LOG_ERROR, "Couldn't get vm_state for destination mailbox!\n"); ast_log(LOG_ERROR, "Couldn't get vm_state for destination mailbox!\n");
return -1; return -1;
} }
@ -2704,7 +2703,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
{ {
SEARCHPGM *pgm; SEARCHPGM *pgm;
SEARCHHEADER *hdr; SEARCHHEADER *hdr;
int ret, urgent = 0; int urgent = 0;
/* If Urgent, then look at INBOX */ /* If Urgent, then look at INBOX */
if (box == 11) { if (box == 11) {
@ -2720,7 +2719,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
vms->imapversion = vmu->imapversion; vms->imapversion = vmu->imapversion;
ast_debug(3, "Before init_mailstream, user is %s\n", vmu->imapuser); ast_debug(3, "Before init_mailstream, user is %s\n", vmu->imapuser);
if ((ret = init_mailstream(vms, box)) || !vms->mailstream) { if (init_mailstream(vms, box) || !vms->mailstream) {
ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n"); ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n");
return -1; return -1;
} }
@ -3047,7 +3046,7 @@ static char *get_header_by_tag(char *header, char *tag, char *buf, size_t len)
static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len) static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len)
{ {
char *start, *quote, *eol_pnt; char *start, *eol_pnt;
if (ast_strlen_zero(mailbox)) if (ast_strlen_zero(mailbox))
return NULL; return NULL;
@ -3057,15 +3056,16 @@ static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len)
ast_copy_string(buf, start+6, len); ast_copy_string(buf, start+6, len);
if (!(quote = strchr(buf, '\"'))) { if (!(quote = strchr(buf, '"'))) {
if (!(eol_pnt = strchr(buf, '/'))) if ((eol_pnt = strchr(buf, '/')) || (eol_pnt = strchr(buf, '}'))) {
eol_pnt = strchr(buf,'}');
*eol_pnt = '\0'; *eol_pnt = '\0';
}
return buf; return buf;
} else { } else {
eol_pnt = strchr(buf+1,'\"'); if ((eol_pnt = strchr(quote + 1, '"'))) {
*eol_pnt = '\0'; *eol_pnt = '\0';
return buf+1; }
return quote + 1;
} }
} }
@ -6347,8 +6347,8 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
COPY(dir, msg, ddir, x, username, context, sfn, dfn); COPY(dir, msg, ddir, x, username, context, sfn, dfn);
} }
ast_unlock_path(ddir); ast_unlock_path(ddir);
#endif
return 0; return 0;
#endif
} }
static int adsi_logo(unsigned char *buf) static int adsi_logo(unsigned char *buf)
@ -7344,7 +7344,7 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
prompt_played++; prompt_played++;
if (res || prompt_played > 4) if (res || prompt_played > 4)
break; break;
if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0)) if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#")) < 0)
break; break;
} }
@ -12775,7 +12775,7 @@ static int vmsayname_exec(struct ast_channel *chan, const char *data)
context = "default"; context = "default";
} }
if ((res = sayname(chan, args_copy, context) < 0)) { if ((res = sayname(chan, args_copy, context)) < 0) {
ast_debug(3, "Greeting not found for '%s@%s', falling back to mailbox number.\n", args_copy, context); ast_debug(3, "Greeting not found for '%s@%s', falling back to mailbox number.\n", args_copy, context);
res = ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY); res = ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
if (!res) { if (!res) {

@ -12060,6 +12060,7 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
} }
if (ioctl(fd, DAHDI_GET_PARAMS, &p)) { if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
ast_log(LOG_WARNING, "Failed to get channel parameters for channel %d: %s\n", channels[y], strerror(errno)); ast_log(LOG_WARNING, "Failed to get channel parameters for channel %d: %s\n", channels[y], strerror(errno));
close(fd);
return -1; return -1;
} }
if (ioctl(fd, DAHDI_SPANSTAT, &si)) { if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
@ -18898,9 +18899,6 @@ static int dahdi_sendtext(struct ast_channel *c, const char *text)
int size,res,fd,len,x; int size,res,fd,len,x;
int bytes=0; int bytes=0;
/* Initial carrier (imaginary) */ /* Initial carrier (imaginary) */
float cr = 1.0;
float ci = 0.0;
float scont = 0.0;
int idx; int idx;
if (!text[0]) { if (!text[0]) {

@ -3099,7 +3099,7 @@ static int try_firmware(char *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, (unsigned long)ast_random());
if ((res = stat(s, &stbuf) < 0)) { if (stat(s, &stbuf) < 0) {
ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno)); ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
return -1; return -1;
} }

@ -7406,7 +7406,6 @@ static struct ast_frame *misdn_read(struct ast_channel *ast)
static int misdn_write(struct ast_channel *ast, struct ast_frame *frame) static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
{ {
struct chan_list *ch; struct chan_list *ch;
int i = 0;
if (!ast || !(ch = MISDN_ASTERISK_TECH_PVT(ast))) { if (!ast || !(ch = MISDN_ASTERISK_TECH_PVT(ast))) {
return -1; return -1;

@ -275,7 +275,8 @@ struct register_message {
uint32_t maxStreams; uint32_t maxStreams;
uint32_t space; uint32_t space;
uint8_t protocolVersion; uint8_t protocolVersion;
char space2[3] ; /*! \brief space2 is used for newer version of skinny */
char space2[3];
}; };
#define IP_PORT_MESSAGE 0x0002 #define IP_PORT_MESSAGE 0x0002
@ -459,6 +460,7 @@ struct start_media_transmission_message_ip6 {
uint32_t packetSize; uint32_t packetSize;
uint32_t payloadType; uint32_t payloadType;
struct media_qualifier qualifier; struct media_qualifier qualifier;
/*! \brief space2 is used for newer version of skinny */
uint32_t space2[19]; uint32_t space2[19];
}; };

@ -387,7 +387,6 @@ enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
*/ */
struct sound { struct sound {
int ind; int ind;
char *desc;
short *data; short *data;
int datalen; int datalen;
int samplen; int samplen;

@ -56,9 +56,8 @@ struct h263_desc {
static int h263_open(struct ast_filestream *s) static int h263_open(struct ast_filestream *s)
{ {
unsigned int ts; unsigned int ts;
int res;
if ((res = fread(&ts, 1, sizeof(ts), s->f)) < sizeof(ts)) { if (fread(&ts, 1, sizeof(ts), s->f) < sizeof(ts)) {
ast_log(LOG_WARNING, "Empty file!\n"); ast_log(LOG_WARNING, "Empty file!\n");
return -1; return -1;
} }

@ -474,7 +474,6 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, stru
int64_t flength, i; /* iterator needs to be signed, so it can go negative and terminate the loop */ int64_t flength, i; /* iterator needs to be signed, so it can go negative and terminate the loop */
int64_t offset_offset = -1, length_offset = -1; int64_t offset_offset = -1, length_offset = -1;
char dos_state = 0; char dos_state = 0;
size_t readlen;
AST_DECLARE_APP_ARGS(args, AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename); AST_APP_ARG(filename);
AST_APP_ARG(offset); AST_APP_ARG(offset);
@ -636,7 +635,7 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, stru
/* Don't let previous values influence current counts, due to short reads */ /* Don't let previous values influence current counts, due to short reads */
memset(fbuf, 0, sizeof(fbuf)); memset(fbuf, 0, sizeof(fbuf));
} }
if (fread(fbuf, 1, sizeof(fbuf), ff) && !feof(ff)) { if (fread(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf) && !feof(ff)) {
ast_log(LOG_ERROR, "Short read?!!\n"); ast_log(LOG_ERROR, "Short read?!!\n");
fclose(ff); fclose(ff);
return -1; return -1;
@ -688,8 +687,10 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, stru
ast_debug(3, "offset=%" PRId64 ", length=%" PRId64 ", offset_offset=%" PRId64 ", length_offset=%" PRId64 "\n", offset, length, offset_offset, length_offset); ast_debug(3, "offset=%" PRId64 ", length=%" PRId64 ", offset_offset=%" PRId64 ", length_offset=%" PRId64 "\n", offset, length, offset_offset, length_offset);
for (i = offset_offset; i < flength; i += sizeof(fbuf)) { for (i = offset_offset; i < flength; i += sizeof(fbuf)) {
char *pos; char *pos;
if ((readlen = fread(fbuf, 1, sizeof(fbuf), ff)) < sizeof(fbuf) && !feof(ff)) { if (fread(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf) && !feof(ff)) {
ast_log(LOG_ERROR, "Short read?!!\n"); ast_log(LOG_ERROR, "Short read?!!\n");
fclose(ff);
return -1;
} }
for (pos = fbuf; pos < fbuf + sizeof(fbuf); pos++) { for (pos = fbuf; pos < fbuf + sizeof(fbuf); pos++) {
LINE_COUNTER(pos, format, current_length); LINE_COUNTER(pos, format, current_length);

@ -1504,7 +1504,7 @@ static int unload_module(void)
AST_RWLIST_WRLOCK(&queries); AST_RWLIST_WRLOCK(&queries);
AST_RWLIST_UNLOCK(&queries); AST_RWLIST_UNLOCK(&queries);
return 0; return res;
} }
static int reload(void) static int reload(void)

@ -584,7 +584,6 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
AST_APP_ARG(delimiter); AST_APP_ARG(delimiter);
AST_APP_ARG(fieldvalue); AST_APP_ARG(fieldvalue);
); );
const char *ptr;
struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16); struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16);
const char *begin, *cur, *next; const char *begin, *cur, *next;
int dlen, flen, first = 1; int dlen, flen, first = 1;
@ -624,7 +623,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
} }
/* If the string isn't there, just copy out the string and be done with it. */ /* If the string isn't there, just copy out the string and be done with it. */
if (!(ptr = strstr(ast_str_buffer(orig_list), args.fieldvalue))) { if (!strstr(ast_str_buffer(orig_list), args.fieldvalue)) {
if (buf) { if (buf) {
ast_copy_string(buf, ast_str_buffer(orig_list), len); ast_copy_string(buf, ast_str_buffer(orig_list), len);
} else { } else {

@ -127,9 +127,9 @@ static int get_local_address(struct ast_sockaddr *ourip)
struct ifaddrs *ifap, *ifaphead; struct ifaddrs *ifap, *ifaphead;
int rtnerr; int rtnerr;
const struct sockaddr_in *sin; const struct sockaddr_in *sin;
int best_score = -100;
#endif /* BSD_OR_LINUX */ #endif /* BSD_OR_LINUX */
struct in_addr best_addr; struct in_addr best_addr;
int best_score = -100;
memset(&best_addr, 0, sizeof(best_addr)); memset(&best_addr, 0, sizeof(best_addr));
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__) || defined(__GLIBC__) #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__) || defined(__GLIBC__)

@ -440,12 +440,14 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
{ {
struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner); struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
char spacebuf[8000]; /* best safe than sorry */ char spacebuf[8000]; /* best safe than sorry */
char spacebuf2[8000]; /* best safe than sorry */
int i=0; int i=0;
char *s2 = expr2_token_subst(s); char *s2 = expr2_token_subst(s);
spacebuf[0] = 0; spacebuf[0] = 0;
for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
spacebuf[i] = ' ';
}
/* uh... assuming yyg is defined, then I can use the yycolumn macro,
which is the same thing as... get this: which is the same thing as... get this:
yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
I was tempted to just use yy_buf_pos in the STATE, but..., well: I was tempted to just use yy_buf_pos in the STATE, but..., well:
@ -456,16 +458,17 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
yy_scan_string func, it creates a single buffer the size of yy_scan_string func, it creates a single buffer the size of
string, so the two would be the same... string, so the two would be the same...
so, in the end, the yycolumn macro is available, shorter, therefore easier. */ so, in the end, the yycolumn macro is available, shorter, therefore easier. */
spacebuf2[i++]='^';
spacebuf2[i]= 0; spacebuf[i++] = '^';
spacebuf[i] = 0;
#ifdef STANDALONE3 #ifdef STANDALONE3
/* easier to read in the standalone version */ /* easier to read in the standalone version */
printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n", printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2); (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#else #else
ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n", ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2); (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#endif #endif
#ifndef STANDALONE #ifndef STANDALONE
ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n"); ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");

@ -2589,12 +2589,14 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
{ {
struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner); struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
char spacebuf[8000]; /* best safe than sorry */ char spacebuf[8000]; /* best safe than sorry */
char spacebuf2[8000]; /* best safe than sorry */
int i=0; int i=0;
char *s2 = expr2_token_subst(s); char *s2 = expr2_token_subst(s);
spacebuf[0] = 0; spacebuf[0] = 0;
for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro, for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
spacebuf[i] = ' ';
}
/* uh... assuming yyg is defined, then I can use the yycolumn macro,
which is the same thing as... get this: which is the same thing as... get this:
yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
I was tempted to just use yy_buf_pos in the STATE, but..., well: I was tempted to just use yy_buf_pos in the STATE, but..., well:
@ -2605,16 +2607,17 @@ int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
ast_yy_scan_string func, it creates a single buffer the size of ast_yy_scan_string func, it creates a single buffer the size of
string, so the two would be the same... string, so the two would be the same...
so, in the end, the yycolumn macro is available, shorter, therefore easier. */ so, in the end, the yycolumn macro is available, shorter, therefore easier. */
spacebuf2[i++]='^';
spacebuf2[i]= 0; spacebuf[i++] = '^';
spacebuf[i] = 0;
#ifdef STANDALONE3 #ifdef STANDALONE3
/* easier to read in the standalone version */ /* easier to read in the standalone version */
printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n", printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2); (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#else #else
ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n", ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
(extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2); (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#endif #endif
#ifndef STANDALONE #ifndef STANDALONE
ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n"); ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");

@ -3891,7 +3891,7 @@ void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, str
{ {
/* Substitutes variables into buf, based on string templ */ /* Substitutes variables into buf, based on string templ */
char *cp4 = NULL; char *cp4 = NULL;
const char *tmp, *whereweare; const char *whereweare;
int orig_size = 0; int orig_size = 0;
int offset, offset2, isfunction; int offset, offset2, isfunction;
const char *nextvar, *nextexp, *nextthing; const char *nextvar, *nextexp, *nextthing;
@ -3901,7 +3901,7 @@ void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, str
struct ast_str *substr1 = ast_str_create(16), *substr2 = NULL, *substr3 = ast_str_create(16); struct ast_str *substr1 = ast_str_create(16), *substr2 = NULL, *substr3 = ast_str_create(16);
ast_str_reset(*buf); ast_str_reset(*buf);
whereweare = tmp = templ; whereweare = templ;
while (!ast_strlen_zero(whereweare)) { while (!ast_strlen_zero(whereweare)) {
/* reset our buffer */ /* reset our buffer */
ast_str_reset(substr3); ast_str_reset(substr3);
@ -4082,7 +4082,7 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead
{ {
/* Substitutes variables into cp2, based on string cp1, cp2 NO LONGER NEEDS TO BE ZEROED OUT!!!! */ /* Substitutes variables into cp2, based on string cp1, cp2 NO LONGER NEEDS TO BE ZEROED OUT!!!! */
char *cp4 = NULL; char *cp4 = NULL;
const char *tmp, *whereweare, *orig_cp2 = cp2; const char *whereweare, *orig_cp2 = cp2;
int length, offset, offset2, isfunction; int length, offset, offset2, isfunction;
char *workspace = NULL; char *workspace = NULL;
char *ltmp = NULL, *var = NULL; char *ltmp = NULL, *var = NULL;
@ -4091,7 +4091,7 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead
int pos, brackets, needsub, len; int pos, brackets, needsub, len;
*cp2 = 0; /* just in case nothing ends up there */ *cp2 = 0; /* just in case nothing ends up there */
whereweare=tmp=cp1; whereweare = cp1;
while (!ast_strlen_zero(whereweare) && count) { while (!ast_strlen_zero(whereweare) && count) {
/* Assume we're copying the whole remaining string */ /* Assume we're copying the whole remaining string */
pos = strlen(whereweare); pos = strlen(whereweare);

@ -1045,7 +1045,6 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
{ {
unsigned int seq; unsigned int seq;
unsigned int len = f->datalen; unsigned int len = f->datalen;
int res;
/* if no max datagram size is provided, use default value */ /* if no max datagram size is provided, use default value */
const int bufsize = (s->far_max_datagram > 0) ? s->far_max_datagram : DEFAULT_FAX_MAX_DATAGRAM; const int bufsize = (s->far_max_datagram > 0) ? s->far_max_datagram : DEFAULT_FAX_MAX_DATAGRAM;
uint8_t buf[bufsize]; uint8_t buf[bufsize];
@ -1083,13 +1082,15 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
len = udptl_build_packet(s, buf, sizeof(buf), f->data.ptr, len); len = udptl_build_packet(s, buf, sizeof(buf), f->data.ptr, len);
if ((signed int) len > 0 && !ast_sockaddr_isnull(&s->them)) { if ((signed int) len > 0 && !ast_sockaddr_isnull(&s->them)) {
if ((res = ast_sendto(s->fd, buf, len, 0, &s->them)) < 0) if (ast_sendto(s->fd, buf, len, 0, &s->them) < 0) {
ast_log(LOG_NOTICE, "UDPTL (%s): Transmission error to %s: %s\n", ast_log(LOG_NOTICE, "UDPTL (%s): Transmission error to %s: %s\n",
LOG_TAG(s), ast_sockaddr_stringify(&s->them), strerror(errno)); LOG_TAG(s), ast_sockaddr_stringify(&s->them), strerror(errno));
if (udptl_debug_test_addr(&s->them)) }
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 %d, len %d)\n",
LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len); LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len);
} }
}
return 0; return 0;
} }

@ -155,12 +155,11 @@ static void __attribute__((format(printf, 2, 3))) fdprintf(int fd, char *fmt, ..
{ {
char stuff[4096]; char stuff[4096];
va_list ap; va_list ap;
int res;
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(stuff, sizeof(stuff), fmt, ap); vsnprintf(stuff, sizeof(stuff), fmt, ap);
va_end(ap); va_end(ap);
if ((res = write(fd, stuff, strlen(stuff))) < 0) { if (write(fd, stuff, strlen(stuff)) < 0) {
fprintf(stderr, "write() failed: %s\n", strerror(errno)); fprintf(stderr, "write() failed: %s\n", strerror(errno));
} }
} }

Loading…
Cancel
Save