diff --git a/src/MeoAssistant/AsstPlatform.h b/src/MeoAssistant/AsstPlatform.h index a6db5dcf58..b1bec29c20 100644 --- a/src/MeoAssistant/AsstPlatform.h +++ b/src/MeoAssistant/AsstPlatform.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -24,7 +25,7 @@ namespace asst::platform if (!_ptr) throw std::bad_alloc(); } - single_page_buffer(nullptr_t) {} + explicit single_page_buffer(std::nullptr_t) {} ~single_page_buffer() { @@ -35,8 +36,8 @@ namespace asst::platform single_page_buffer(const single_page_buffer&) = delete; single_page_buffer& operator=(const single_page_buffer&) = delete; - inline single_page_buffer(single_page_buffer&& other) { std::swap(_ptr, other._ptr); } - inline single_page_buffer& operator=(single_page_buffer&& other) + inline single_page_buffer(single_page_buffer&& other) noexcept { std::swap(_ptr, other._ptr); } + inline single_page_buffer& operator=(single_page_buffer&& other) noexcept { if (_ptr) { aligned_free(reinterpret_cast(_ptr)); diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 74270f643f..5b76630a60 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -399,14 +398,13 @@ std::optional asst::Controller::call_command(const std::string& cmd } else if (m_child > 0) { // parent process - std::unique_lock pipe_lock(m_pipe_mutex); do { - ssize_t read_num = read(m_pipe_out[PIPE_READ], pipe_buffer.get(), PipeBuffSize); + ssize_t read_num = read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size()); while (read_num > 0) { pipe_data.insert(pipe_data.end(), pipe_buffer.get(), pipe_buffer.get() + read_num); - read_num = read(m_pipe_out[PIPE_READ], pipe_buffer.get(), PipeBuffSize); - }; + read_num = read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size()); + } } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout()); } else {