From 169101c80b78084e089edb7f33f5f90a70ae5b0d Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Thu, 3 Aug 2017 22:10:25 -0700 Subject: [PATCH] modernize: use bool literals, raw string literal --- encfs/FileUtils.cpp | 5 +++-- encfs/NameIO.h | 2 +- encfs/XmlReader.cpp | 2 +- encfs/main.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index a8c5b38..2c4a8f3 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -22,7 +22,8 @@ #ifdef linux #define _XOPEN_SOURCE 500 // make sure pwrite() is pulled in #endif -#define _BSD_SOURCE // pick up setenv on RH7.3 +#define _BSD_SOURCE // pick up setenv on RH7.3 +#define _DEFAULT_SOURCE // Replaces _BSD_SOURCE #include "internal/easylogging++.h" #include @@ -1416,7 +1417,7 @@ std::string readPassword(int FD) { char buffer[1024]; string result; - while (1) { + while (true) { ssize_t rdSize = recv(FD, buffer, sizeof(buffer), 0); if (rdSize > 0) { diff --git a/encfs/NameIO.h b/encfs/NameIO.h index 2264a64..7085970 100644 --- a/encfs/NameIO.h +++ b/encfs/NameIO.h @@ -139,7 +139,7 @@ class NameIO { delete[] Name; \ Name = Name##_Raw; \ } \ - } while (0); + } while (false); } // namespace encfs diff --git a/encfs/XmlReader.cpp b/encfs/XmlReader.cpp index c4e938b..4685f6d 100644 --- a/encfs/XmlReader.cpp +++ b/encfs/XmlReader.cpp @@ -101,7 +101,7 @@ bool XmlValue::readB64(const char *path, unsigned char *data, return false; } if (!B64StandardDecode(data, (unsigned char *)s.data(), s.size())) { - RLOG(ERROR) << "B64 decode failure on \"" << s << "\""; + RLOG(ERROR) << R"(B64 decode failure on ")" << s << R"(")"; return false; } diff --git a/encfs/main.cpp b/encfs/main.cpp index 640fe4f..104ba38 100644 --- a/encfs/main.cpp +++ b/encfs/main.cpp @@ -169,7 +169,7 @@ static void FuseUsage() { do { \ rAssert(out->fuseArgc < MaxFuseArgs); \ out->fuseArgv[out->fuseArgc++] = (ARG); \ - } while (0) + } while (false) static string slashTerminate(const string &src) { string result = src; @@ -233,7 +233,7 @@ static bool processArgs(int argc, char *argv[], {"require-macs", 0, nullptr, LONG_OPT_REQUIRE_MAC}, // require MACs {nullptr, 0, nullptr, 0}}; - while (1) { + while (true) { int option_index = 0; // 's' : single-threaded mode