From 258b9e512c4001e806c5c0966acecd3d742ec6e9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 4 Nov 2015 21:08:55 +0100 Subject: apply various suggestions made by cppcheck Reported-By: cppcheck Git-Dch: Ignore --- methods/ftp.h | 2 +- methods/gzip.cc | 2 +- methods/http.h | 2 +- methods/https.cc | 4 ++-- methods/https.h | 4 +--- methods/rred.cc | 4 ++-- methods/rsh.h | 4 ++-- 7 files changed, 10 insertions(+), 12 deletions(-) (limited to 'methods') diff --git a/methods/ftp.h b/methods/ftp.h index c5165782d..de2c232bd 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -68,7 +68,7 @@ class FTPConn Hashes &MD5,bool &Missing, unsigned long long MaximumSize, pkgAcqMethod *Owner); - FTPConn(URI Srv); + explicit FTPConn(URI Srv); ~FTPConn(); }; diff --git a/methods/gzip.cc b/methods/gzip.cc index fbfd3bbac..c470807ac 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -36,7 +36,7 @@ class GzipMethod : public aptMethod public: - GzipMethod(std::string const &pProg) : aptMethod(pProg.c_str(),"1.1",SingleInstance | SendConfig), Prog(pProg) {}; + explicit GzipMethod(std::string const &pProg) : aptMethod(pProg.c_str(),"1.1",SingleInstance | SendConfig), Prog(pProg) {}; }; // GzipMethod::Fetch - Decompress the passed URI /*{{{*/ diff --git a/methods/http.h b/methods/http.h index 7b7e78b64..9e2b1da5c 100644 --- a/methods/http.h +++ b/methods/http.h @@ -87,7 +87,7 @@ class CircleBuf // Dump everything void Stats(); - CircleBuf(unsigned long long Size); + explicit CircleBuf(unsigned long long Size); ~CircleBuf(); }; diff --git a/methods/https.cc b/methods/https.cc index 8d9454545..a99b1861b 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -49,7 +49,7 @@ size_t HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp) { size_t len = size * nmemb; - CURLUserPointer *me = (CURLUserPointer *)userp; + CURLUserPointer *me = static_cast(userp); std::string line((char*) buffer, len); for (--len; len > 0; --len) if (isspace(line[len]) == 0) @@ -115,7 +115,7 @@ HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp) size_t HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp) { - HttpsMethod *me = (HttpsMethod *)userp; + HttpsMethod *me = static_cast(userp); size_t buffer_size = size * nmemb; // we don't need to count the junk here, just drop anything we get as // we don't always know how long it would be, e.g. in chunked encoding. diff --git a/methods/https.h b/methods/https.h index 0147f96a0..4d50c5a04 100644 --- a/methods/https.h +++ b/methods/https.h @@ -68,21 +68,19 @@ class HttpsMethod : public ServerMethod double ultotal, double ulnow); void SetupProxy(); CURL *curl; - std::unique_ptr Server; // Used by ServerMethods unused by https virtual void SendReq(FetchItem *) APT_OVERRIDE { exit(42); } virtual void RotateDNS() APT_OVERRIDE { exit(42); } public: - FileFd *File; virtual bool Configuration(std::string Message) APT_OVERRIDE; virtual std::unique_ptr CreateServerState(URI const &uri) APT_OVERRIDE; using pkgAcqMethod::FetchResult; using pkgAcqMethod::FetchItem; - HttpsMethod() : ServerMethod("https","1.2",Pipeline | SendConfig), File(NULL) + HttpsMethod() : ServerMethod("https","1.2",Pipeline | SendConfig) { curl = curl_easy_init(); }; diff --git a/methods/rred.cc b/methods/rred.cc index b379d384d..bb801cb4e 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -39,7 +39,7 @@ class MemBlock { char *free; MemBlock *next; - MemBlock(size_t size) : size(size), next(NULL) + explicit MemBlock(size_t size) : size(size), next(NULL) { free = start = new char[size]; } @@ -118,7 +118,7 @@ struct Change { size_t add_len; /* bytes */ char *add; - Change(size_t off) + explicit Change(size_t off) { offset = off; del_cnt = add_cnt = add_len = 0; diff --git a/methods/rsh.h b/methods/rsh.h index 9ca14425f..35cbee3e0 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -49,7 +49,7 @@ class RSHConn bool Get(const char *Path,FileFd &To,unsigned long long Resume, Hashes &Hash,bool &Missing, unsigned long long Size); - RSHConn(URI Srv); + explicit RSHConn(URI Srv); ~RSHConn(); }; @@ -71,7 +71,7 @@ class RSHMethod : public aptMethod public: - RSHMethod(std::string const &Prog); + explicit RSHMethod(std::string const &Prog); }; #endif -- cgit v1.2.3