diff --git a/src/uvw/handle.hpp b/src/uvw/handle.hpp index b4816070..129f9776 100644 --- a/src/uvw/handle.hpp +++ b/src/uvw/handle.hpp @@ -86,7 +86,7 @@ public: * @return True if the handle is active, false otherwise. */ bool active() const UVW_NOEXCEPT { - return !(uv_is_active(as_uv_handle()) == 0); + return !!uv_is_active(as_uv_handle()); } /** @@ -98,7 +98,7 @@ public: * @return True if the handle is closing or closed, false otherwise. */ bool closing() const UVW_NOEXCEPT { - return !(uv_is_closing(as_uv_handle()) == 0); + return !!uv_is_closing(as_uv_handle()); } /** @@ -140,7 +140,7 @@ public: * @return True if the handle referenced, false otherwise. */ bool referenced() const UVW_NOEXCEPT { - return !(uv_has_ref(as_uv_handle()) == 0); + return !!uv_has_ref(as_uv_handle()); } /** @@ -160,12 +160,13 @@ public: * udp handles on Windows.
* Note that Linux will return double the size of the original set value. * - * @return The size of the send buffer, 0 in case of errors. + * @return The size of the send buffer, the underlying return value in case + * of errors. */ int send_buffer_size() { int value = 0; auto err = uv_send_buffer_size(as_uv_handle(), &value); - return err ? 0 : value; + return err ? err : value; } /** @@ -177,10 +178,10 @@ public: * udp handles on Windows.
* Note that Linux will set double the size. * - * @return True in case of success, false otherwise. + * @return Underlying return value. */ - bool send_buffer_size(int value) { - return (0 == uv_send_buffer_size(as_uv_handle(), &value)); + int send_buffer_size(int value) { + return uv_send_buffer_size(as_uv_handle(), &value); } /** @@ -192,12 +193,13 @@ public: * udp handles on Windows.
* Note that Linux will return double the size of the original set value. * - * @return The size of the receive buffer, 0 in case of errors. + * @return The size of the receive buffer, the underlying return value in + * case of errors. */ int recv_buffer_size() { int value = 0; auto err = uv_recv_buffer_size(as_uv_handle(), &value); - return err ? 0 : value; + return err ? err : value; } /** @@ -209,10 +211,10 @@ public: * udp handles on Windows.
* Note that Linux will set double the size. * - * @return True in case of success, false otherwise. + * @return Underlying return value. */ - bool recv_buffer_size(int value) { - return (0 == uv_recv_buffer_size(as_uv_handle(), &value)); + int recv_buffer_size(int value) { + return uv_recv_buffer_size(as_uv_handle(), &value); } /** diff --git a/src/uvw/loop.cpp b/src/uvw/loop.cpp index 442594e9..569ee14f 100644 --- a/src/uvw/loop.cpp +++ b/src/uvw/loop.cpp @@ -68,7 +68,7 @@ int loop::run(run_mode mode) UVW_NOEXCEPT { } UVW_INLINE bool loop::alive() const UVW_NOEXCEPT { - return !(uv_loop_alive(uv_loop.get()) == 0); + return !!uv_loop_alive(uv_loop.get()); } UVW_INLINE void loop::stop() UVW_NOEXCEPT { diff --git a/src/uvw/pipe.cpp b/src/uvw/pipe.cpp index 0ef3b825..614dd7f2 100644 --- a/src/uvw/pipe.cpp +++ b/src/uvw/pipe.cpp @@ -55,8 +55,8 @@ UVW_INLINE handle_type pipe_handle::receive() UVW_NOEXCEPT { return utilities::guess_handle(category); } -UVW_INLINE bool pipe_handle::chmod(chmod_flags flags) UVW_NOEXCEPT { - return (0 == uv_pipe_chmod(raw(), static_cast(flags))); +UVW_INLINE int pipe_handle::chmod(chmod_flags flags) UVW_NOEXCEPT { + return uv_pipe_chmod(raw(), static_cast(flags)); } } // namespace uvw diff --git a/src/uvw/pipe.h b/src/uvw/pipe.h index 0cf7f84b..d80947a1 100644 --- a/src/uvw/pipe.h +++ b/src/uvw/pipe.h @@ -145,9 +145,9 @@ public: * for further details. * * @param flags A valid set of flags. - * @return True in case of success, false otherwise. + * @return Underlying return value. */ - bool chmod(chmod_flags flags) UVW_NOEXCEPT; + int chmod(chmod_flags flags) UVW_NOEXCEPT; private: bool ipc; diff --git a/test/uvw/handle.cpp b/test/uvw/handle.cpp index e3e4ab87..73b0e1e8 100644 --- a/test/uvw/handle.cpp +++ b/test/uvw/handle.cpp @@ -37,11 +37,11 @@ TEST(Handle, Functionalities) { ASSERT_NE(handle->size(), static_castsize())>(0)); - ASSERT_EQ(handle->send_buffer_size(), static_castsend_buffer_size())>(0)); - ASSERT_FALSE(handle->send_buffer_size(0)); + ASSERT_LT(handle->send_buffer_size(), 0); + ASSERT_NE(0, handle->send_buffer_size(0)); - ASSERT_EQ(handle->recv_buffer_size(), static_castrecv_buffer_size())>(0)); - ASSERT_FALSE(handle->recv_buffer_size(0)); + ASSERT_LT(handle->recv_buffer_size(), 0); + ASSERT_NE(0, handle->recv_buffer_size(0)); ASSERT_NO_THROW(handle->fd()); }