Fix buffer_copy
boost::asio::buffer_copy returns an integer of the number of values
copied. Some static analysis tools mark that value as nodiscard,
although it should never fail. Audit all uses of buffer_copy, and make
sure that they're using the return value. In theory this should have
no change on the behavior.
Change-Id: I6af39b5347954c2932cf3d4e48e96ff9ae01583a
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index 0089ae3..df13a67 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -52,11 +52,11 @@
BMCWEB_LOG_DEBUG("conn:{}, Read {} bytes from websocket", logPtr(&conn),
data.size());
- boost::asio::buffer_copy(inputBuffer.prepare(data.size()),
- boost::asio::buffer(data));
+ size_t copied = boost::asio::buffer_copy(
+ inputBuffer.prepare(data.size()), boost::asio::buffer(data));
BMCWEB_LOG_DEBUG("conn:{}, Committing {} bytes from websocket",
- logPtr(&conn), data.size());
- inputBuffer.commit(data.size());
+ logPtr(&conn), copied);
+ inputBuffer.commit(copied);
BMCWEB_LOG_DEBUG("conn:{}, inputbuffer size {}", logPtr(&conn),
inputBuffer.size());