summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2017-06-20 10:58:54 +0200
committerTimo Weingärtner <timo@tiwe.de>2017-07-02 13:22:37 +0200
commit07d402e83fd6b58d53825441169503cc92fd71d6 (patch)
tree7280dc45896ec4f9f7bd89f2288b662afbec97ab
parentce1d8ee5bd88cc05c6e0cdee4517bb1ab8fb6100 (diff)
downloadhadori-07d402e83fd6b58d53825441169503cc92fd71d6.tar.gz
Clang lints ('static' and typing)
-rw-r--r--hadori.C14
1 files changed, 7 insertions, 7 deletions
diff --git a/hadori.C b/hadori.C
index b1f0e5f..f5aebda 100644
--- a/hadori.C
+++ b/hadori.C
@@ -40,8 +40,8 @@ namespace po = boost::program_options;
#include "version.h"
-po::variables_map config;
-std::ostream debug(std::clog.rdbuf()), verbose(std::clog.rdbuf()), error(std::clog.rdbuf());
+static po::variables_map config;
+static std::ostream debug(std::clog.rdbuf()), verbose(std::clog.rdbuf()), error(std::clog.rdbuf());
struct inode {
std::string const filename;
@@ -59,7 +59,7 @@ inline bool compare (inode const & l, inode const & r) {
rf.read(rbuffer, sizeof(rbuffer));
if (lf.gcount() != rf.gcount())
return false;
- if (memcmp(lbuffer, rbuffer, lf.gcount()))
+ if (memcmp(lbuffer, rbuffer, static_cast<size_t>(lf.gcount())))
return false;
}
return true;
@@ -70,7 +70,7 @@ inline std::ostream& operator<< (std::ostream& os, inode const & i) {
return os;
}
-void do_link (inode const & i, std::string const & other) {
+static void do_link (inode const & i, std::string const & other) {
if (!link(i.filename.c_str(), other.c_str())) {
error << "linking " << i << " to " << other << " succeeded before unlinking (race condition)" << std::endl;
exit(EX_UNAVAILABLE);
@@ -92,7 +92,7 @@ void do_link (inode const & i, std::string const & other) {
}
}
-void handle_file(std::string const & path, struct stat const & s) {
+static void handle_file (std::string const & path, struct stat const & s) {
static std::unordered_map<ino_t, inode const> kept;
static std::unordered_map<ino_t, ino_t const> to_link;
static std::unordered_multimap<off_t, ino_t const> sizes;
@@ -138,7 +138,7 @@ void handle_file(std::string const & path, struct stat const & s) {
sizes.insert({s.st_size, s.st_ino});
}
-void recurse (std::string const & dir, dev_t const dev) {
+static void recurse (std::string const & dir, dev_t const dev) {
DIR* D;
struct dirent *d;
struct stat s;
@@ -179,7 +179,7 @@ void recurse (std::string const & dir, dev_t const dev) {
}
}
-void recurse_start (std::string const & dir) {
+static void recurse_start (std::string const & dir) {
struct stat s;
if (lstat(dir.c_str(), &s)) {