aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-05-16 18:57:36 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-05-16 18:57:36 +0300
commit16933c951386a563971149d2beb3dc2147a0db8e (patch)
treeb458a9e2efdb37f7998c9e5e1e0970dcaa8eddd1
parentremove VS 2013 cruft (diff)
downloadwinapi-common-16933c951386a563971149d2beb3dc2147a0db8e.tar.gz
winapi-common-16933c951386a563971149d2beb3dc2147a0db8e.zip
clang-tidy fixes
-rw-r--r--include/winapi/cmd_line.hpp4
-rw-r--r--src/cmd_line.cpp8
-rw-r--r--src/process.cpp2
-rw-r--r--src/sid.cpp2
4 files changed, 5 insertions, 11 deletions
diff --git a/include/winapi/cmd_line.hpp b/include/winapi/cmd_line.hpp
index d635350..8735660 100644
--- a/include/winapi/cmd_line.hpp
+++ b/include/winapi/cmd_line.hpp
@@ -27,9 +27,7 @@ public:
explicit CommandLine(std::string&& argv0, std::vector<std::string>&& args = {})
: m_argv0{std::move(argv0)}, m_args{std::move(args)} {}
- explicit CommandLine(const std::vector<std::string>& argv);
-
- explicit CommandLine(std::vector<std::string>&& argv);
+ explicit CommandLine(std::vector<std::string> argv);
static std::string escape(const std::string&);
diff --git a/src/cmd_line.cpp b/src/cmd_line.cpp
index 3fc0a7e..4c8afb0 100644
--- a/src/cmd_line.cpp
+++ b/src/cmd_line.cpp
@@ -57,7 +57,7 @@ std::string split_argv0(std::vector<std::string>& argv) {
if (argv.empty()) {
throw std::range_error{"argv must contain at least one element"};
}
- const auto argv0 = argv[0];
+ auto argv0 = argv[0];
argv.erase(argv.begin());
return argv0;
}
@@ -86,11 +86,7 @@ CommandLine CommandLine::from_main(int argc, wchar_t* argv[]) {
return CommandLine{narrow_all(argc, argv)};
}
-CommandLine::CommandLine(const std::vector<std::string>& argv) : m_args{argv} {
- m_argv0 = split_argv0(m_args);
-}
-
-CommandLine::CommandLine(std::vector<std::string>&& argv) : m_args{std::move(argv)} {
+CommandLine::CommandLine(std::vector<std::string> argv) : m_args{std::move(argv)} {
m_argv0 = split_argv0(m_args);
}
diff --git a/src/process.cpp b/src/process.cpp
index 9a602c8..e0799d5 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -28,7 +28,7 @@
namespace winapi {
namespace {
-typedef std::vector<wchar_t> EscapedCommandLine;
+using EscapedCommandLine = std::vector<wchar_t>;
EscapedCommandLine escape_command_line(const CommandLine& cmd_line) {
const auto unicode_cmd_line = widen(cmd_line.to_string());
diff --git a/src/sid.cpp b/src/sid.cpp
index 23be61a..376924f 100644
--- a/src/sid.cpp
+++ b/src/sid.cpp
@@ -23,7 +23,7 @@ Sid Sid::well_known(WELL_KNOWN_SID_TYPE type) {
Buffer buffer;
buffer.resize(MAX_SID_SIZE);
- DWORD cb = static_cast<DWORD>(buffer.size());
+ auto cb = static_cast<DWORD>(buffer.size());
if (!::CreateWellKnownSid(type, NULL, buffer.data(), &cb))
throw error::windows(GetLastError(), "CreateWellKnownSid");