summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorWalter Doekes <walter+asterisk@wjd.nu>2012-04-17 18:57:40 +0000
committerWalter Doekes <walter+asterisk@wjd.nu>2012-04-17 18:57:40 +0000
commitfc63e07135d645af0df8d393aa84c0ae3b7e1924 (patch)
treef40524fe8e0facf5542c6b02041bc1fc63eae66e /channels
parent70c5ac6635062efe03b51fb6c7afd30c22028be9 (diff)
Avoid cppcheck warnings; removing unused vars and a bit of cleanup.
Patch by: junky Review: https://reviewboard.asterisk.org/r/1743/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_alsa.c3
-rw-r--r--channels/chan_dahdi.c2
-rw-r--r--channels/chan_gtalk.c3
-rw-r--r--channels/chan_h323.c3
-rw-r--r--channels/chan_sip.c2
-rw-r--r--channels/chan_unistim.c11
-rw-r--r--channels/vcodecs.c3
7 files changed, 14 insertions, 13 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 0ebfd3f22..5079fb6ba 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -440,7 +440,6 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
static int left = FRAME_SIZE;
snd_pcm_state_t state;
int r = 0;
- int off = 0;
ast_mutex_lock(&alsalock);
f.frametype = AST_FRAME_NULL;
@@ -478,8 +477,6 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
snd_pcm_prepare(alsa.icard);
} else if (r < 0) {
ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r));
- } else if (r >= 0) {
- off -= r;
}
/* Update positions */
readpos += r;
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 2e537f870..86a5f41b6 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -15282,7 +15282,7 @@ static char *dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
{
#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s %-32.32s\n"
#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s %-32.32s\n"
- unsigned int targetnum = 0;
+ int targetnum = 0;
int filtertype = 0;
struct dahdi_pvt *tmp = NULL;
char tmps[20] = "";
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index e51282581..20f2589c3 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -839,7 +839,6 @@ static int gtalk_get_local_ip(struct ast_sockaddr *ourip)
struct ast_sockaddr root;
struct ast_sockaddr bindaddr_tmp;
struct ast_sockaddr *addrs;
- int addrs_cnt;
/* If bind address is not 0.0.0.0, then bindaddr is our local ip. */
ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr);
@@ -850,7 +849,7 @@ static int gtalk_get_local_ip(struct ast_sockaddr *ourip)
/* If no bind address was provided, lets see what ip we would use to connect to google.com and use that.
* If you can't resolve google.com from your network, then this module is useless for you anyway. */
- if ((addrs_cnt = ast_sockaddr_resolve(&addrs, "google.com", PARSE_PORT_FORBID, AF_INET)) > 0) {
+ if (ast_sockaddr_resolve(&addrs, "google.com", PARSE_PORT_FORBID, AF_INET) > 0) {
ast_sockaddr_copy(&root, &addrs[0]);
ast_free(addrs);
if (!ast_ouraddrfor(&root, ourip)) {
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 5feb1e740..2dc0bdc57 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -1436,8 +1436,9 @@ static struct oh323_user *build_user(const char *name, struct ast_variable *v, s
user->options.holdHandling = 0;
/* Set default context */
ast_copy_string(user->context, default_context, sizeof(user->context));
- if (user && !found)
+ if (!found) {
ast_copy_string(user->name, name, sizeof(user->name));
+ }
#if 0 /* XXX Port channel variables functionality from chan_sip XXX */
if (user->chanvars) {
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 080dc9df8..61437187a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4509,7 +4509,7 @@ static int sip_sendtext(struct ast_channel *ast, const char *text)
}
if(!is_method_allowed(&dialog->allowed_methods, SIP_MESSAGE)) {
ast_debug(2, "Trying to send MESSAGE to device that does not support it.\n");
- return(0);
+ return 0;
}
debug = sip_debug_test_pvt(dialog);
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 723500e45..411d8f4e7 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -891,8 +891,6 @@ static void send_raw_client(int size, const unsigned char *data, struct sockaddr
#ifdef DUMP_PACKET
if (unistimdebug) {
int tmp;
- char iabuf[INET_ADDRSTRLEN];
- char iabuf2[INET_ADDRSTRLEN];
ast_verb(0, "\n**> From %s sending %d bytes to %s ***\n",
ast_inet_ntoa(addr_ourip->sin_addr), (int) size,
ast_inet_ntoa(addr_to->sin_addr));
@@ -3952,12 +3950,14 @@ static char open_history(struct unistimsession *pte, char way, FILE ** f)
if (fread(&count, 1, 1, *f) != 1) {
display_last_error("Unable to read history header - display.");
fclose(*f);
+ *f = NULL;
return 0;
}
if (count > MAX_ENTRY_LOG) {
ast_log(LOG_WARNING, "Invalid count in history header of %s (%d max %d)\n", tmp,
count, MAX_ENTRY_LOG);
fclose(*f);
+ *f = NULL;
return 0;
}
return count;
@@ -4922,7 +4922,6 @@ static int unistimsock_read(int *id, int fd, short events, void *ignore)
unsigned int size_addr_from;
#ifdef DUMP_PACKET
int dw_num_bytes_rcvdd;
- char iabuf[INET_ADDRSTRLEN];
#endif
size_addr_from = sizeof(addr_from);
@@ -5369,7 +5368,11 @@ static int unistim_sendtext(struct ast_channel *ast, const char *text)
}
if (!text) {
ast_log(LOG_WARNING, "unistim_sendtext called with a null text\n");
- return 1;
+ return -1;
+ }
+
+ if (!pte) {
+ return -1;
}
size = strlen(text);
diff --git a/channels/vcodecs.c b/channels/vcodecs.c
index c667fdb13..db591cad3 100644
--- a/channels/vcodecs.c
+++ b/channels/vcodecs.c
@@ -1131,8 +1131,9 @@ static enum CodecID map_video_format(uint32_t ast_format, int rw)
struct _cm *i;
for (i = video_formats; i->ast_format != 0; i++)
- if (ast_format & i->ast_format && rw & i->rw && rw & i->rw)
+ if (ast_format & i->ast_format && rw & i->rw) {
return i->codec;
+ }
return CODEC_ID_NONE;
}