summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libadhocutil/curlMultiHandle.cpp1
-rw-r--r--libadhocutil/curlStream.cpp1
-rw-r--r--libadhocutil/fileUtils.cpp1
-rw-r--r--libadhocutil/processPipes.cpp20
-rw-r--r--libadhocutil/runtimeContext.cpp1
-rw-r--r--libadhocutil/unittests/Jamfile.jam5
-rw-r--r--libadhocutil/uriParse.cpp5
7 files changed, 22 insertions, 12 deletions
diff --git a/libadhocutil/curlMultiHandle.cpp b/libadhocutil/curlMultiHandle.cpp
index ac40b49..65e9464 100644
--- a/libadhocutil/curlMultiHandle.cpp
+++ b/libadhocutil/curlMultiHandle.cpp
@@ -4,6 +4,7 @@
#include "runtimeContext.h"
#include "curlStream.h"
+// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
namespace AdHoc {
namespace Net {
diff --git a/libadhocutil/curlStream.cpp b/libadhocutil/curlStream.cpp
index 69f04f0..3fb441f 100644
--- a/libadhocutil/curlStream.cpp
+++ b/libadhocutil/curlStream.cpp
@@ -1,5 +1,6 @@
#include "curlStream.h"
+// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
namespace AdHoc {
namespace Net {
diff --git a/libadhocutil/fileUtils.cpp b/libadhocutil/fileUtils.cpp
index 4e7b809..f54189f 100644
--- a/libadhocutil/fileUtils.cpp
+++ b/libadhocutil/fileUtils.cpp
@@ -5,6 +5,7 @@
#include <sys/mman.h>
#include <boost/assert.hpp>
+// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
namespace AdHoc {
namespace FileUtils {
AdHocFormatter(FD, "FD %?");
diff --git a/libadhocutil/processPipes.cpp b/libadhocutil/processPipes.cpp
index f968fab..90e6d14 100644
--- a/libadhocutil/processPipes.cpp
+++ b/libadhocutil/processPipes.cpp
@@ -7,14 +7,16 @@
#include <sys.h>
#include "scopeExit.h"
+// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
namespace AdHoc {
namespace System {
+using PipePair = std::array<int, 2>;
static
void
-pipe(int pipes[2], ScopeExit & tidyUp)
+pipe(PipePair & pipes, ScopeExit & tidyUp)
{
- if (::pipe(pipes)) {
+ if (::pipe(pipes.data())) {
throw SystemException("pipe(2) failed", strerror(errno), errno);
}
tidyUp.onFailure.emplace_back([pipes] {
@@ -31,16 +33,16 @@ ProcessPipes::ProcessPipes(const std::vector<std::string> & args, bool i, bool o
if (args.empty()) {
throw std::invalid_argument("args is empty");
}
- std::array<int, 2> ipipes { -1, -1 }, opipes { -1, -1 }, epipes { -1, -1 };
+ PipePair ipipes { -1, -1 }, opipes { -1, -1 }, epipes { -1, -1 };
ScopeExit tidyUp;
if (i) {
- pipe(ipipes.data(), tidyUp);
+ pipe(ipipes, tidyUp);
}
if (o) {
- pipe(opipes.data(), tidyUp);
+ pipe(opipes, tidyUp);
}
if (e) {
- pipe(epipes.data(), tidyUp);
+ pipe(epipes, tidyUp);
}
switch (child = fork()) {
case -1: // fail
@@ -73,14 +75,14 @@ ProcessPipes::ProcessPipes(const std::vector<std::string> & args, bool i, bool o
dup2(epipes[1], 2);
}
closeAllOpenFiles();
- char * buf[100];
- char ** w = &buf[0];
+ std::vector<char *> buf(args.size() + 1);
+ auto w = buf.begin();
for (const auto & p : args) {
*w++ = strdup(p.c_str());
}
*w = nullptr;
if (buf[0]) {
- execv(buf[0], (char * const *)buf);
+ execv(buf[0], buf.data());
}
abort();
break;
diff --git a/libadhocutil/runtimeContext.cpp b/libadhocutil/runtimeContext.cpp
index 8d3aeea..6b31743 100644
--- a/libadhocutil/runtimeContext.cpp
+++ b/libadhocutil/runtimeContext.cpp
@@ -3,6 +3,7 @@
#include <cstring>
#include <sys.h>
+// NOLINTNEXTLINE(modernize-concat-nested-namespaces)
namespace AdHoc {
namespace System {
diff --git a/libadhocutil/unittests/Jamfile.jam b/libadhocutil/unittests/Jamfile.jam
index 02a9275..6b04540 100644
--- a/libadhocutil/unittests/Jamfile.jam
+++ b/libadhocutil/unittests/Jamfile.jam
@@ -19,6 +19,11 @@ lib stdc++fs ;
lib pthread ;
lib dl ;
+project
+ : requirements
+ <toolset>tidy:<xcheckxx>misc-non-private-member-variables-in-classes
+ ;
+
h lorem-ipsum : lorem-ipsum.txt ;
run
diff --git a/libadhocutil/uriParse.cpp b/libadhocutil/uriParse.cpp
index 2d8a557..ba507c8 100644
--- a/libadhocutil/uriParse.cpp
+++ b/libadhocutil/uriParse.cpp
@@ -14,7 +14,6 @@ namespace AdHoc {
{
auto * puri = this;
const char *curstr;
- int i;
int userpass_flag;
int bracket_flag;
@@ -24,8 +23,8 @@ namespace AdHoc {
if (!tmpstr) {
throw InvalidUri("Schema marker not found", uri);
}
- int len = tmpstr - curstr;
- for (i = 0; i < len; i++) {
+ auto len = tmpstr - curstr;
+ for (decltype(len) i = 0; i < len; i++) {
if (!_is_scheme_char(curstr[i])) {
throw InvalidUri("Invalid format", uri);
}