From f7f0d6c7560a8f71707e7852a512469147aa9f84 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Aug 2011 20:53:28 +0200 Subject: cppcheck complains about some possible speed improvements which could be done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types. --- methods/ftp.cc | 2 +- methods/gpgv.cc | 6 +++--- methods/http.cc | 6 +++--- methods/mirror.cc | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'methods') diff --git a/methods/ftp.cc b/methods/ftp.cc index 97248f900..c2c485769 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -559,7 +559,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::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::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::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/mirror.cc b/methods/mirror.cc index 713dc211a..565df5327 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -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::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) -- cgit v1.2.3