summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorWalter Doekes <walter+asterisk@wjd.nu>2012-02-08 20:49:48 +0000
committerWalter Doekes <walter+asterisk@wjd.nu>2012-02-08 20:49:48 +0000
commitdb24fc2523da16bd812abb2a35b6320d24083e3f (patch)
tree4f4d564d4c32538014aefd01789f3f2bffc5520e /funcs
parent0adeb88318467f75f84a70990b1f982b9ca470f3 (diff)
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
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_env.c7
-rw-r--r--funcs/func_odbc.c2
-rw-r--r--funcs/func_strings.c3
3 files changed, 6 insertions, 6 deletions
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 {