summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/chan_mobile.c14
-rw-r--r--addons/chan_ooh323.c21
-rw-r--r--addons/ooh323c/src/memheap.c3
-rw-r--r--apps/app_alarmreceiver.c2
-rw-r--r--apps/app_chanspy.c9
-rw-r--r--apps/app_dial.c3
-rw-r--r--apps/app_disa.c2
-rw-r--r--apps/app_minivm.c3
-rw-r--r--apps/app_osplookup.c10
-rw-r--r--apps/app_queue.c4
-rw-r--r--apps/app_voicemail.c38
-rw-r--r--channels/chan_dahdi.c4
-rw-r--r--channels/chan_iax2.c2
-rw-r--r--channels/chan_misdn.c1
-rw-r--r--channels/chan_skinny.c4
-rw-r--r--channels/chan_usbradio.c1
-rw-r--r--formats/format_h263.c3
-rw-r--r--funcs/func_env.c7
-rw-r--r--funcs/func_odbc.c2
-rw-r--r--funcs/func_strings.c3
-rw-r--r--main/acl.c2
-rw-r--r--main/ast_expr2.fl43
-rw-r--r--main/ast_expr2f.c43
-rw-r--r--main/pbx.c8
-rw-r--r--main/udptl.c7
-rw-r--r--utils/astman.c3
26 files changed, 123 insertions, 119 deletions
diff --git a/addons/chan_mobile.c b/addons/chan_mobile.c
index efdda4e64..90b059e0f 100644
--- a/addons/chan_mobile.c
+++ b/addons/chan_mobile.c
@@ -2975,7 +2975,6 @@ static int sdp_search(char *addr, int profile)
static sdp_session_t *sdp_register(void)
{
-
uint32_t service_uuid_int[] = {0, 0, 0, GENERIC_AUDIO_SVCLASS_ID};
uint8_t rfcomm_channel = 1;
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)))
ast_log(LOG_WARNING, "Failed to connect sdp and create session.\n");
- else
- sdp_record_register(session, record, 0);
+ else {
+ 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_list_free(rfcomm_list, 0);
@@ -4083,18 +4086,17 @@ static void *do_discovery(void *data)
static void *do_sco_listen(void *data)
{
struct adapter_pvt *adapter = (struct adapter_pvt *) data;
- int res;
while (!check_unloading()) {
/* 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 */
ast_log(LOG_ERROR, "ast_io_wait() failed for adapter %s\n", adapter->id);
break;
}
/* 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);
break;
}
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 38fdcfbba..e6f45f32a 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -3518,7 +3518,6 @@ static int function_ooh323_write(struct ast_channel *chan, const char *cmd, char
static int load_module(void)
{
- int res;
struct ooAliases * pNewAlias = NULL;
struct ooh323_peer *peer = NULL;
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 */
if (ast_channel_register(&ooh323_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
@@ -3622,10 +3621,10 @@ static int load_module(void)
ast_mutex_lock(&peerl.lock);
peer = peerl.peers;
while (peer) {
- if(peer->h323id) ooH323EpAddAliasH323ID(peer->h323id);
- if(peer->email) ooH323EpAddAliasEmailID(peer->email);
- if(peer->e164) ooH323EpAddAliasDialedDigits(peer->e164);
- if(peer->url) ooH323EpAddAliasURLID(peer->url);
+ if(peer->h323id) ooH323EpAddAliasH323ID(peer->h323id);
+ if(peer->email) ooH323EpAddAliasEmailID(peer->email);
+ if(peer->e164) ooH323EpAddAliasDialedDigits(peer->e164);
+ if(peer->url) ooH323EpAddAliasURLID(peer->url);
peer = peer->next;
}
ast_mutex_unlock(&peerl.lock);
@@ -3667,7 +3666,7 @@ static int load_module(void)
/* Create H.323 listener */
if (ooCreateH323Listener() != OO_OK) {
- ast_log(LOG_ERROR, "OOH323 Listener Creation failure. "
+ ast_log(LOG_ERROR, "OOH323 Listener Creation failure. "
"OOH323 DISABLED\n");
ooH323EpDestroy();
@@ -3675,7 +3674,7 @@ static int load_module(void)
}
if (ooh323c_start_stack_thread() < 0) {
- ast_log(LOG_ERROR, "Failed to start OOH323 stack thread. "
+ ast_log(LOG_ERROR, "Failed to start OOH323 stack thread. "
"OOH323 DISABLED\n");
ooH323EpDestroy();
return 1;
@@ -4186,7 +4185,6 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
/* XXX Deal with Video */
struct ooh323_pvt *p;
struct ast_sockaddr tmp;
- int mode;
if (gH323Debug)
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;
}
- 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;
if (!p) {
ast_log(LOG_ERROR, "No Private Structure, this is bad\n");
diff --git a/addons/ooh323c/src/memheap.c b/addons/ooh323c/src/memheap.c
index f92fa5384..c7aed04e5 100644
--- a/addons/ooh323c/src/memheap.c
+++ b/addons/ooh323c/src/memheap.c
@@ -726,7 +726,7 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
OSMemLink** ppMemLink;
OSMemBlk* pMemBlk;
OSMemElemDescr* pElem;
- OSMemLink* pMemLink, *pPrevMemLink = 0;
+ OSMemLink* pMemLink;
void *newMem_p;
unsigned nbytes, nunits;
@@ -758,7 +758,6 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
*(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_;
return pMemLink->pMemBlk;
}
- pPrevMemLink = pMemLink;
}
/* Round number of bytes to nearest 8-byte boundary */
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index 20171e023..44782f0c7 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -251,7 +251,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
break;
}
- if ((r = ast_waitfor(chan, -1) < 0)) {
+ if ((r = ast_waitfor(chan, -1)) < 0) {
ast_debug(1, "Waitfor returned %d\n", r);
continue;
}
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 4c709cfcc..ab7887764 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -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
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)) {
running = -1;
break;
@@ -771,7 +771,6 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
int waitms;
int res;
char *ptr;
- int num;
int num_spyed_upon = 1;
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);
}
if (!ast_test_flag(flags, OPTION_NAME) || res < 0) {
+ int num;
if (!ast_test_flag(flags, OPTION_NOTECH)) {
if (ast_fileexists(peer_name, NULL, NULL) > 0) {
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));
}
}
- if ((num = atoi(ptr)))
- ast_say_digits(chan, atoi(ptr), "", ast_channel_language(chan));
+ if ((num = atoi(ptr))) {
+ ast_say_digits(chan, num, "", ast_channel_language(chan));
+ }
}
}
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 18cbe8d76..d900f4f2c 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1706,7 +1706,6 @@ static int setup_privacy_args(struct privacy_args *pa,
char callerid[60];
int res;
char *l;
- int silencethreshold;
if (chan->caller.id.number.valid
&& !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:"
*/
- silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
+ int silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
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 */
/* don't think we'll need a lock removed, we took care of
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 78830f1c3..7d92b7642 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -214,7 +214,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
break;
}
- if ((res = ast_waitfor(chan, -1) < 0)) {
+ if ((res = ast_waitfor(chan, -1)) < 0) {
ast_debug(1, "Waitfor returned %d\n", res);
continue;
}
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index da9f68954..3ffe06187 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -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)
{
char *username, *domain, *countername;
- struct minivm_account *vmu = NULL;
char userpath[BUFSIZ];
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 (!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);
return 0;
}
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index 336de102c..4ce2846cf 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -614,7 +614,6 @@ struct osp_metrics {
float min; /* Minimum */
float max; /* Maximum */
float avg; /* Average */
- float ndev; /* Normal deviation */
float sdev; /* Standard deviation */
};
@@ -1452,7 +1451,7 @@ static int osp_create_callid(
if (callid == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n");
- res = OSP_ERROR;
+ return OSP_ERROR;
}
callid->len = sizeof(callid->buf);
@@ -1463,6 +1462,7 @@ static int osp_create_callid(
case OSP_CALLID_SIP:
case OSP_CALLID_IAX:
res = OSP_FAILED;
+ break;
default:
res = OSP_ERROR;
break;
@@ -1529,7 +1529,7 @@ static int osp_lookup(
if (results == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n");
- res = OSP_ERROR;
+ return OSP_ERROR;
}
osp_convert_inout(results->dest, dest, sizeof(dest));
@@ -1787,7 +1787,7 @@ static int osp_lookup(
/*!
* \brief OSP Lookup Next function
* \param name OSP provider name
- * \param cause Asterisk hangup cuase
+ * \param cause Asterisk hangup cause
* \param results Lookup results, in/output
* \return OSP_OK Found , OSP_FAILED No route, OSP_ERROR Error
*/
@@ -1809,7 +1809,7 @@ static int osp_next(
if (results == NULL) {
ast_log(LOG_ERROR, "Invalid parameters\n");
- res = OSP_ERROR;
+ return OSP_ERROR;
}
results->outtech[0] = '\0';
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 6557d512b..12bdb45ba 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4860,10 +4860,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
/* Begin Monitoring */
if (qe->parent->monfmt && *qe->parent->monfmt) {
if (!qe->parent->montype) {
- const char *monexec, *monargs;
+ const char *monexec;
ast_debug(1, "Starting Monitor as requested.\n");
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;
monexec = monexec ? ast_strdupa(monexec) : NULL;
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 48b757d39..710787714 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1949,9 +1949,8 @@ static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_
*vms_p->introfn = '\0';
ast_mutex_lock(&vms_p->lock);
- init_mailstream(vms_p, GREETINGS_FOLDER);
- if (!vms_p->mailstream) {
- ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL\n");
+ if (init_mailstream(vms_p, GREETINGS_FOLDER) || !vms_p->mailstream) {
+ ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL or can't init_mailstream\n");
ast_mutex_unlock(&vms_p->lock);
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)
{
- 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...*/
if (msgnum >= recip->maxmsg) {
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");
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");
return -1;
}
@@ -2704,7 +2703,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
{
SEARCHPGM *pgm;
SEARCHHEADER *hdr;
- int ret, urgent = 0;
+ int urgent = 0;
/* If Urgent, then look at INBOX */
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;
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");
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)
{
- char *start, *quote, *eol_pnt;
+ char *start, *eol_pnt;
if (ast_strlen_zero(mailbox))
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);
- if (!(quote = strchr(buf, '\"'))) {
- if (!(eol_pnt = strchr(buf, '/')))
- eol_pnt = strchr(buf,'}');
- *eol_pnt = '\0';
+ if (!(quote = strchr(buf, '"'))) {
+ if ((eol_pnt = strchr(buf, '/')) || (eol_pnt = strchr(buf, '}'))) {
+ *eol_pnt = '\0';
+ }
return buf;
} else {
- eol_pnt = strchr(buf+1,'\"');
- *eol_pnt = '\0';
- return buf+1;
+ if ((eol_pnt = strchr(quote + 1, '"'))) {
+ *eol_pnt = '\0';
+ }
+ 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);
}
ast_unlock_path(ddir);
-#endif
return 0;
+#endif
}
static int adsi_logo(unsigned char *buf)
@@ -7344,10 +7344,10 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
prompt_played++;
if (res || prompt_played > 4)
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;
}
-
+
/* start all over if no username */
if (ast_strlen_zero(username))
continue;
@@ -12775,7 +12775,7 @@ static int vmsayname_exec(struct ast_channel *chan, const char *data)
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);
res = ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
if (!res) {
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 067c32aa9..4288532ff 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -12060,6 +12060,7 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
}
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));
+ close(fd);
return -1;
}
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 bytes=0;
/* Initial carrier (imaginary) */
- float cr = 1.0;
- float ci = 0.0;
- float scont = 0.0;
int idx;
if (!text[0]) {
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 7b9e4312f..5789e4393 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -3099,7 +3099,7 @@ static int try_firmware(char *s)
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));
return -1;
}
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index db446a2c0..2bfbaddfc 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -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)
{
struct chan_list *ch;
- int i = 0;
if (!ast || !(ch = MISDN_ASTERISK_TECH_PVT(ast))) {
return -1;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 274af25ce..69773dca7 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -275,7 +275,8 @@ struct register_message {
uint32_t maxStreams;
uint32_t space;
uint8_t protocolVersion;
- char space2[3] ;
+ /*! \brief space2 is used for newer version of skinny */
+ char space2[3];
};
#define IP_PORT_MESSAGE 0x0002
@@ -459,6 +460,7 @@ struct start_media_transmission_message_ip6 {
uint32_t packetSize;
uint32_t payloadType;
struct media_qualifier qualifier;
+ /*! \brief space2 is used for newer version of skinny */
uint32_t space2[19];
};
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index 3edba81de..51bf91119 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -387,7 +387,6 @@ enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
*/
struct sound {
int ind;
- char *desc;
short *data;
int datalen;
int samplen;
diff --git a/formats/format_h263.c b/formats/format_h263.c
index 77c1229c3..b00ae0fb3 100644
--- a/formats/format_h263.c
+++ b/formats/format_h263.c
@@ -56,9 +56,8 @@ struct h263_desc {
static int h263_open(struct ast_filestream *s)
{
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");
return -1;
}
diff --git a/funcs/func_env.c b/funcs/func_env.c
index c7b431dca..2e10fc228 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -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 offset_offset = -1, length_offset = -1;
char dos_state = 0;
- size_t readlen;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
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 */
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");
fclose(ff);
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);
for (i = offset_offset; i < flength; i += sizeof(fbuf)) {
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");
+ fclose(ff);
+ return -1;
}
for (pos = fbuf; pos < fbuf + sizeof(fbuf); pos++) {
LINE_COUNTER(pos, format, current_length);
diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c
index edb69f093..f86f7608a 100644
--- a/funcs/func_odbc.c
+++ b/funcs/func_odbc.c
@@ -1504,7 +1504,7 @@ static int unload_module(void)
AST_RWLIST_WRLOCK(&queries);
AST_RWLIST_UNLOCK(&queries);
- return 0;
+ return res;
}
static int reload(void)
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index 5d7569bfe..ff04be827 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -584,7 +584,6 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
AST_APP_ARG(delimiter);
AST_APP_ARG(fieldvalue);
);
- const char *ptr;
struct ast_str *orig_list = ast_str_thread_get(&tmp_buf, 16);
const char *begin, *cur, *next;
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 (!(ptr = strstr(ast_str_buffer(orig_list), args.fieldvalue))) {
+ if (!strstr(ast_str_buffer(orig_list), args.fieldvalue)) {
if (buf) {
ast_copy_string(buf, ast_str_buffer(orig_list), len);
} else {
diff --git a/main/acl.c b/main/acl.c
index 6361b71d8..2c9e40086 100644
--- a/main/acl.c
+++ b/main/acl.c
@@ -127,9 +127,9 @@ static int get_local_address(struct ast_sockaddr *ourip)
struct ifaddrs *ifap, *ifaphead;
int rtnerr;
const struct sockaddr_in *sin;
+ int best_score = -100;
#endif /* BSD_OR_LINUX */
struct in_addr best_addr;
- int best_score = -100;
memset(&best_addr, 0, sizeof(best_addr));
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__) || defined(__GLIBC__)
diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl
index 624618e9f..5c7e6a549 100644
--- a/main/ast_expr2.fl
+++ b/main/ast_expr2.fl
@@ -437,35 +437,38 @@ static char *expr2_token_subst(const char *mess)
}
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
-{
+{
struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
char spacebuf[8000]; /* best safe than sorry */
- char spacebuf2[8000]; /* best safe than sorry */
int i=0;
char *s2 = expr2_token_subst(s);
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,
- which is the same thing as... get this:
- 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:
- a. the yy_buf_pos is the current position in the buffer, which
- may not relate to the entire string/buffer because of the
- buffering.
- b. but, analysis of the situation is that when you use the
- yy_scan_string func, it creates a single buffer the size of
- string, so the two would be the same...
- so, in the end, the yycolumn macro is available, shorter, therefore easier. */
- spacebuf2[i++]='^';
- spacebuf2[i]= 0;
+
+ 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:
+ 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:
+ a. the yy_buf_pos is the current position in the buffer, which
+ may not relate to the entire string/buffer because of the
+ buffering.
+ b. but, analysis of the situation is that when you use the
+ yy_scan_string func, it creates a single buffer the size of
+ string, so the two would be the same...
+ so, in the end, the yycolumn macro is available, shorter, therefore easier. */
+
+ spacebuf[i++] = '^';
+ spacebuf[i] = 0;
#ifdef STANDALONE3
/* easier to read in the standalone version */
- printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
- (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+ printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+ (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#else
- 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);
+ 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, spacebuf);
#endif
#ifndef STANDALONE
ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");
diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c
index cc0f0f195..1314ea84d 100644
--- a/main/ast_expr2f.c
+++ b/main/ast_expr2f.c
@@ -2586,35 +2586,38 @@ static char *expr2_token_subst(const char *mess)
}
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
-{
+{
struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
char spacebuf[8000]; /* best safe than sorry */
- char spacebuf2[8000]; /* best safe than sorry */
int i=0;
char *s2 = expr2_token_subst(s);
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,
- which is the same thing as... get this:
- 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:
- a. the yy_buf_pos is the current position in the buffer, which
- may not relate to the entire string/buffer because of the
- buffering.
- b. but, analysis of the situation is that when you use the
- ast_yy_scan_string func, it creates a single buffer the size of
- string, so the two would be the same...
- so, in the end, the yycolumn macro is available, shorter, therefore easier. */
- spacebuf2[i++]='^';
- spacebuf2[i]= 0;
+
+ 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:
+ 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:
+ a. the yy_buf_pos is the current position in the buffer, which
+ may not relate to the entire string/buffer because of the
+ buffering.
+ b. but, analysis of the situation is that when you use the
+ ast_yy_scan_string func, it creates a single buffer the size of
+ string, so the two would be the same...
+ so, in the end, the yycolumn macro is available, shorter, therefore easier. */
+
+ spacebuf[i++] = '^';
+ spacebuf[i] = 0;
#ifdef STANDALONE3
/* easier to read in the standalone version */
- printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
- (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+ printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+ (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#else
- 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);
+ 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, spacebuf);
#endif
#ifndef STANDALONE
ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");
diff --git a/main/pbx.c b/main/pbx.c
index 8fa2c40a6..50224e4de 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -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 */
char *cp4 = NULL;
- const char *tmp, *whereweare;
+ const char *whereweare;
int orig_size = 0;
int offset, offset2, isfunction;
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);
ast_str_reset(*buf);
- whereweare = tmp = templ;
+ whereweare = templ;
while (!ast_strlen_zero(whereweare)) {
/* reset our buffer */
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!!!! */
char *cp4 = NULL;
- const char *tmp, *whereweare, *orig_cp2 = cp2;
+ const char *whereweare, *orig_cp2 = cp2;
int length, offset, offset2, isfunction;
char *workspace = 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;
*cp2 = 0; /* just in case nothing ends up there */
- whereweare=tmp=cp1;
+ whereweare = cp1;
while (!ast_strlen_zero(whereweare) && count) {
/* Assume we're copying the whole remaining string */
pos = strlen(whereweare);
diff --git a/main/udptl.c b/main/udptl.c
index 943cd286a..be5fff10d 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -1045,7 +1045,6 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
{
unsigned int seq;
unsigned int len = f->datalen;
- int res;
/* 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;
uint8_t buf[bufsize];
@@ -1083,12 +1082,14 @@ int ast_udptl_write(struct ast_udptl *s, struct ast_frame *f)
len = udptl_build_packet(s, buf, sizeof(buf), f->data.ptr, len);
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",
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",
LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len);
+ }
}
return 0;
diff --git a/utils/astman.c b/utils/astman.c
index 459eeee71..b48d60b25 100644
--- a/utils/astman.c
+++ b/utils/astman.c
@@ -155,12 +155,11 @@ static void __attribute__((format(printf, 2, 3))) fdprintf(int fd, char *fmt, ..
{
char stuff[4096];
va_list ap;
- int res;
va_start(ap, fmt);
vsnprintf(stuff, sizeof(stuff), fmt, 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));
}
}