diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-12 10:32:05 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-12 10:32:05 +0200 |
commit | ea50fdfe2fc21757412baf448b2d41b3ce34b626 (patch) | |
tree | 8910d5504be3cb1952ce33bbabbc0c02a832c735 /methods | |
parent | 851d681d0af7f3346d77738e4708b21ed6e2cc98 (diff) | |
parent | f5a34606b4a910e7b7b984940fb2d12681a2dd3b (diff) |
lots of cppcheck fixes
Diffstat (limited to 'methods')
-rw-r--r-- | methods/cdrom.cc | 3 | ||||
-rw-r--r-- | methods/ftp.cc | 5 | ||||
-rw-r--r-- | methods/gpgv.cc | 6 | ||||
-rw-r--r-- | methods/http.cc | 6 | ||||
-rw-r--r-- | methods/http.h | 14 | ||||
-rw-r--r-- | methods/mirror.cc | 6 | ||||
-rw-r--r-- | methods/rred.cc | 7 | ||||
-rw-r--r-- | methods/rsh.h | 2 |
8 files changed, 27 insertions, 22 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc index b25fdf5a8..ae699dfc3 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -54,7 +54,8 @@ class CDROMMethod : public pkgAcqMethod CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | SendConfig | NeedsCleanup | Removable), - DatabaseLoaded(false), + DatabaseLoaded(false), + Debug(false), MountedByApt(false) { UdevCdroms.Dlopen(); diff --git a/methods/ftp.cc b/methods/ftp.cc index 97248f900..eb7fedd85 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -69,7 +69,8 @@ time_t FtpMethod::FailTime = 0; // --------------------------------------------------------------------- /* */ FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1), - DataListenFd(-1), ServerName(Srv) + DataListenFd(-1), ServerName(Srv), + ForceExtended(false), TryPassive(true) { Debug = _config->FindB("Debug::Acquire::Ftp",false); PasvAddr = 0; @@ -559,7 +560,7 @@ bool FTPConn::ExtGoPasv() string::const_iterator List[4]; unsigned Count = 0; Pos++; - for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++) + for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I) { if (*I != Msg[Pos]) continue; diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 960c06180..3ad3e8d84 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -213,21 +213,21 @@ bool GPGVMethod::Fetch(FetchItem *Itm) { errmsg += _("The following signatures were invalid:\n"); for (vector<string>::iterator I = BadSigners.begin(); - I != BadSigners.end(); I++) + I != BadSigners.end(); ++I) errmsg += (*I + "\n"); } if (!WorthlessSigners.empty()) { errmsg += _("The following signatures were invalid:\n"); for (vector<string>::iterator I = WorthlessSigners.begin(); - I != WorthlessSigners.end(); I++) + I != WorthlessSigners.end(); ++I) errmsg += (*I + "\n"); } if (!NoPubKeySigners.empty()) { errmsg += _("The following signatures couldn't be verified because the public key is not available:\n"); for (vector<string>::iterator I = NoPubKeySigners.begin(); - I != NoPubKeySigners.end(); I++) + I != NoPubKeySigners.end(); ++I) errmsg += (*I + "\n"); } } diff --git a/methods/http.cc b/methods/http.cc index 13f9cbe06..65a0cbbb7 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -402,10 +402,10 @@ ServerState::RunHeadersResult ServerState::RunHeaders() if (Debug == true) clog << Data; - for (string::const_iterator I = Data.begin(); I < Data.end(); I++) + for (string::const_iterator I = Data.begin(); I < Data.end(); ++I) { string::const_iterator J = I; - for (; J != Data.end() && *J != '\n' && *J != '\r';J++); + for (; J != Data.end() && *J != '\n' && *J != '\r'; ++J); if (HeaderLine(string(I,J)) == false) return RUN_HEADERS_PARSE_ERROR; I = J; @@ -1325,7 +1325,7 @@ int HttpMethod::Loop() StopRedirects = true; else { - for (StringVectorIterator I = R.begin(); I != R.end(); I++) + for (StringVectorIterator I = R.begin(); I != R.end(); ++I) if (Queue->Uri == *I) { R[0] = "STOP"; diff --git a/methods/http.h b/methods/http.h index aa96c6810..6302807c5 100644 --- a/methods/http.h +++ b/methods/http.h @@ -36,14 +36,14 @@ class CircleBuf static struct timeval BwReadTick; static const unsigned int BW_HZ; - unsigned long LeftRead() + unsigned long LeftRead() const { unsigned long Sz = Size - (InP - OutP); if (Sz > Size - (InP%Size)) Sz = Size - (InP%Size); return Sz; } - unsigned long LeftWrite() + unsigned long LeftWrite() const { unsigned long Sz = InP - OutP; if (InP > MaxGet) @@ -68,12 +68,12 @@ class CircleBuf // Control the write limit void Limit(long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;} - bool IsLimit() {return MaxGet == OutP;}; - void Print() {cout << MaxGet << ',' << OutP << endl;}; + bool IsLimit() const {return MaxGet == OutP;}; + void Print() const {cout << MaxGet << ',' << OutP << endl;}; // Test for free space in the buffer - bool ReadSpace() {return Size - (InP - OutP) > 0;}; - bool WriteSpace() {return InP - OutP > 0;}; + bool ReadSpace() const {return Size - (InP - OutP) > 0;}; + bool WriteSpace() const {return InP - OutP > 0;}; // Dump everything void Reset(); @@ -113,7 +113,7 @@ struct ServerState URI ServerName; bool HeaderLine(string Line); - bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; + bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0; Encoding = Closes; time(&Date); ServerFd = -1; Pipeline = true;}; diff --git a/methods/mirror.cc b/methods/mirror.cc index 713dc211a..cb24a06cf 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -54,7 +54,7 @@ using namespace std; */ MirrorMethod::MirrorMethod() - : HttpMethod(), DownloadedMirrorFile(false) + : HttpMethod(), DownloadedMirrorFile(false), Debug(false) { }; @@ -107,7 +107,7 @@ bool MirrorMethod::Clean(string Dir) continue; // see if we have that uri - for(I=list.begin(); I != list.end(); I++) + for(I=list.begin(); I != list.end(); ++I) { string uri = (*I)->GetURI(); if(uri.find("mirror://") != 0) @@ -330,7 +330,7 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str) vector<metaIndex *>::const_iterator I; pkgSourceList list; list.ReadMainList(); - for(I=list.begin(); I != list.end(); I++) + for(I=list.begin(); I != list.end(); ++I) { string uristr = (*I)->GetURI(); if(Debug) diff --git a/methods/rred.cc b/methods/rred.cc index 849973e1a..6c55880ca 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -51,7 +51,7 @@ protected: virtual bool Fetch(FetchItem *Itm); public: - RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {}; + RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig), Debug(false) {}; }; /*}}}*/ /** \brief applyFile - in reverse order with a tail recursion {{{ @@ -239,7 +239,9 @@ RredMethod::State RredMethod::patchFile(FileFd &Patch, FileFd &From, /*{{{*/ return result; } /*}}}*/ -struct EdCommand { /*{{{*/ +/* struct EdCommand {{{*/ +#ifdef _POSIX_MAPPED_FILES +struct EdCommand { size_t data_start; size_t data_end; size_t data_lines; @@ -248,6 +250,7 @@ struct EdCommand { /*{{{*/ char type; }; #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */ +#endif /*}}}*/ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/ FileFd &out_file, Hashes *hash) const { diff --git a/methods/rsh.h b/methods/rsh.h index b06d5a94e..98ca6a88c 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -34,7 +34,7 @@ class RSHConn // Raw connection IO bool WriteMsg(string &Text,bool Sync,const char *Fmt,...); bool Connect(string Host, string User); - bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; + bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;}; // Connection control bool Open(); |