summaryrefslogtreecommitdiff
path: root/src/tool_paramhlp.c
diff options
context:
space:
mode:
authorMarian Klymov <nekto1989@gmail.com>2018-06-02 23:52:56 +0300
committerDaniel Stenberg <daniel@haxx.se>2018-06-11 11:14:48 +0200
commitc45360d4633850839bb9c2d77dbf8a8285e9ad49 (patch)
tree20159c553a74ed98c2431fc8f2852067f79ac4e9 /src/tool_paramhlp.c
parent38203f1585da53e07e54e37c7d5da4d72f509a2e (diff)
downloadcurl-c45360d4633850839bb9c2d77dbf8a8285e9ad49.tar.gz
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
Diffstat (limited to 'src/tool_paramhlp.c')
-rw-r--r--src/tool_paramhlp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 7cddf51ce..894d4d414 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -58,14 +58,14 @@ struct getout *new_getout(struct OperationConfig *config)
ParameterError file2string(char **bufp, FILE *file)
{
- char buffer[256];
char *ptr;
char *string = NULL;
- size_t stringlen = 0;
- size_t buflen;
if(file) {
+ char buffer[256];
+ size_t stringlen = 0;
while(fgets(buffer, sizeof(buffer), file)) {
+ size_t buflen;
ptr = strchr(buffer, '\r');
if(ptr)
*ptr = '\0';
@@ -91,11 +91,11 @@ ParameterError file2memory(char **bufp, size_t *size, FILE *file)
{
char *newbuf;
char *buffer = NULL;
- size_t alloc = 512;
size_t nused = 0;
- size_t nread;
if(file) {
+ size_t nread;
+ size_t alloc = 512;
do {
if(!buffer || (alloc == nused)) {
/* size_t overflow detection for huge files */