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
This commit is contained in:
Marian Klymov 2018-06-02 23:52:56 +03:00 committed by Daniel Stenberg
parent 38203f1585
commit c45360d463
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
61 changed files with 213 additions and 273 deletions

View file

@ -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 */