aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--include/winapi/handle.hpp4
-rw-r--r--src/handle.cpp10
-rw-r--r--test/unit_tests/process_worker.cpp6
3 files changed, 10 insertions, 10 deletions
diff --git a/include/winapi/handle.hpp b/include/winapi/handle.hpp
index cd114d5..1145fd6 100644
--- a/include/winapi/handle.hpp
+++ b/include/winapi/handle.hpp
@@ -33,8 +33,8 @@ public:
explicit operator HANDLE() const { return ptr(); }
- bool is_invalid() const;
- static bool is_invalid(HANDLE);
+ bool is_valid() const;
+ static bool is_valid(HANDLE);
void close();
diff --git a/src/handle.cpp b/src/handle.cpp
index ba1e4b5..66f878f 100644
--- a/src/handle.cpp
+++ b/src/handle.cpp
@@ -52,12 +52,12 @@ void Handle::swap(Handle& other) BOOST_NOEXCEPT_OR_NOTHROW {
swap(m_impl, other.m_impl);
}
-bool Handle::is_invalid() const {
- return !m_impl || is_invalid(m_impl.get());
+bool Handle::is_valid() const {
+ return m_impl && is_valid(m_impl.get());
}
-bool Handle::is_invalid(HANDLE handle) {
- return handle == NULL || handle == INVALID_HANDLE_VALUE;
+bool Handle::is_valid(HANDLE handle) {
+ return handle != NULL && handle != INVALID_HANDLE_VALUE;
}
void Handle::close() {
@@ -149,7 +149,7 @@ void Handle::inherit(bool yes) const {
}
void Handle::Close::operator()(HANDLE impl) const {
- if (is_invalid(impl) || is_std_handle(impl))
+ if (!is_valid(impl) || is_std_handle(impl))
return;
const auto ret = ::CloseHandle(impl);
assert(ret);
diff --git a/test/unit_tests/process_worker.cpp b/test/unit_tests/process_worker.cpp
index 492ffff..1ddf1d5 100644
--- a/test/unit_tests/process_worker.cpp
+++ b/test/unit_tests/process_worker.cpp
@@ -85,9 +85,9 @@ void check_std_handles_different(Worker& worker) {
void check_write(Worker& worker) {
const auto handles = worker.test_write();
- BOOST_TEST(!Handle::is_invalid(handles.in));
- BOOST_TEST(!Handle::is_invalid(handles.out));
- BOOST_TEST(!Handle::is_invalid(handles.err));
+ BOOST_TEST(Handle::is_valid(handles.in));
+ BOOST_TEST(Handle::is_valid(handles.out));
+ BOOST_TEST(Handle::is_valid(handles.err));
}
void check_redirected_output(const Buffer& buffer, const std::vector<std::string>& expected_lines) {