summaryrefslogtreecommitdiff
path: root/methods/mirror.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-01-16 22:19:49 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-01-16 22:19:49 +0100
commit9ce3cfc9309c55cc01018c88c1ca82779fd74431 (patch)
treee113a963a732f497d0362d3fff9e5b3834d5a175 /methods/mirror.cc
parent62d8a765b9b37354efab6ca838cbdb7f347f7cac (diff)
correct some style/performance/warnings from cppcheck
The most "visible" change is from utime to utimensat/futimens as the first one isn't part of POSIX anymore. Reported-By: cppcheck Git-Dch: Ignore
Diffstat (limited to 'methods/mirror.cc')
-rw-r--r--methods/mirror.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 854366318..83ef0d133 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -114,7 +114,7 @@ bool MirrorMethod::Clean(string Dir)
for(I=list.begin(); I != list.end(); ++I)
{
string uri = (*I)->GetURI();
- if(uri.find("mirror://") != 0)
+ if(uri.compare(0, strlen("mirror://"), "mirror://") != 0)
continue;
string BaseUri = uri.substr(0,uri.size()-1);
if (URItoFileName(BaseUri) == Dir->d_name)
@@ -198,9 +198,9 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file)
// "stable" on the same machine. this is to avoid running into out-of-sync
// issues (i.e. Release/Release.gpg different on each mirror)
struct utsname buf;
- int seed=1, i;
+ int seed=1;
if(uname(&buf) == 0) {
- for(i=0,seed=1; buf.nodename[i] != 0; i++) {
+ for(int i=0,seed=1; buf.nodename[i] != 0; ++i) {
seed = seed * 31 + buf.nodename[i];
}
}
@@ -306,7 +306,7 @@ bool MirrorMethod::InitMirrors()
if (s.size() == 0)
continue;
// ignore non http lines
- if (s.find("http://") != 0)
+ if (s.compare(0, strlen("http://"), "http://") != 0)
continue;
AllMirrors.push_back(s);