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

@ -163,7 +163,6 @@ static CURLcode inflate_stream(struct connectdata *conn,
z_stream *z = &zp->z; /* zlib state structure */
uInt nread = z->avail_in;
Bytef *orig_in = z->next_in;
int status; /* zlib status */
bool done = FALSE;
CURLcode result = CURLE_OK; /* Curl_client_write status */
char *decomp; /* Put the decompressed data here. */
@ -184,6 +183,7 @@ static CURLcode inflate_stream(struct connectdata *conn,
/* because the buffer size is fixed, iteratively decompress and transfer to
the client via downstream_write function. */
while(!done) {
int status; /* zlib status */
done = TRUE;
/* (re)set buffer for decompressed output for every iteration */
@ -761,7 +761,6 @@ char *Curl_all_content_encodings(void)
const content_encoding * const *cep;
const content_encoding *ce;
char *ace;
char *p;
for(cep = encodings; *cep; cep++) {
ce = *cep;
@ -774,7 +773,7 @@ char *Curl_all_content_encodings(void)
ace = malloc(len);
if(ace) {
p = ace;
char *p = ace;
for(cep = encodings; *cep; cep++) {
ce = *cep;
if(!strcasecompare(ce->name, CONTENT_ENCODING_DEFAULT)) {
@ -921,10 +920,9 @@ void Curl_unencode_cleanup(struct connectdata *conn)
static const content_encoding *find_encoding(const char *name, size_t len)
{
const content_encoding * const *cep;
const content_encoding *ce;
for(cep = encodings; *cep; cep++) {
ce = *cep;
const content_encoding *ce = *cep;
if((strncasecompare(name, ce->name, len) && !ce->name[len]) ||
(ce->alias && strncasecompare(name, ce->alias, len) && !ce->alias[len]))
return ce;