diff options
author | Walter Doekes <walter+asterisk@wjd.nu> | 2012-02-08 20:49:48 +0000 |
---|---|---|
committer | Walter Doekes <walter+asterisk@wjd.nu> | 2012-02-08 20:49:48 +0000 |
commit | db24fc2523da16bd812abb2a35b6320d24083e3f (patch) | |
tree | 4f4d564d4c32538014aefd01789f3f2bffc5520e /funcs/func_env.c | |
parent | 0adeb88318467f75f84a70990b1f982b9ca470f3 (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/func_env.c')
-rw-r--r-- | funcs/func_env.c | 7 |
1 files changed, 4 insertions, 3 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); |