diff --git a/include/asio_net/detail/message.hpp b/include/asio_net/detail/message.hpp index c2c1c64..f71d410 100644 --- a/include/asio_net/detail/message.hpp +++ b/include/asio_net/detail/message.hpp @@ -10,7 +10,7 @@ namespace detail { struct message : private noncopyable { message() = default; - explicit message(std::string msg) : length(msg.length()), body(std::move(msg)) {} + explicit message(std::string msg) : length((uint32_t)msg.length()), body(std::move(msg)) {} void clear() { length = 0; diff --git a/include/asio_net/detail/tcp_channel_t.hpp b/include/asio_net/detail/tcp_channel_t.hpp index 33fc48d..0ac3eb5 100644 --- a/include/asio_net/detail/tcp_channel_t.hpp +++ b/include/asio_net/detail/tcp_channel_t.hpp @@ -234,7 +234,7 @@ class tcp_channel_t : private noncopyable { typename socket_impl::socket& socket_; const tcp_config& config_; detail::message read_msg_; - uint32_t send_buffer_now_ = 0; + size_t send_buffer_now_ = 0; std::deque write_msg_queue_; }; diff --git a/include/asio_net/rpc_core b/include/asio_net/rpc_core index 813ed97..992c1d0 160000 --- a/include/asio_net/rpc_core +++ b/include/asio_net/rpc_core @@ -1 +1 @@ -Subproject commit 813ed97c6cec4b349a25b280edbd4fa6413af4dd +Subproject commit 992c1d059332cc0b63ddc964f43c8ca7d9f266b2 diff --git a/include/asio_net/serial_port.hpp b/include/asio_net/serial_port.hpp index 0655fa8..8867dd9 100644 --- a/include/asio_net/serial_port.hpp +++ b/include/asio_net/serial_port.hpp @@ -96,18 +96,18 @@ class serial_port : detail::noncopyable { // queue for asio::async_write if (!from_queue && send_buffer_now_ != 0) { ASIO_NET_LOGV("queue for asio::async_write"); - send_buffer_now_ += msg.size(); + send_buffer_now_ += (uint32_t)msg.size(); write_msg_queue_.emplace_back(std::move(msg)); return; } if (!from_queue) { - send_buffer_now_ += msg.size(); + send_buffer_now_ += (uint32_t)msg.size(); } auto keeper = std::make_unique(std::move(msg)); auto buffer = asio::buffer(keeper->body); asio::async_write(serial_, buffer, [this, keeper = std::move(keeper)](const std::error_code& ec, std::size_t /*length*/) { - send_buffer_now_ -= keeper->body.size(); + send_buffer_now_ -= (uint32_t)keeper->body.size(); if (ec) { do_close(); } diff --git a/test/udp_c.cpp b/test/udp_c.cpp index 2780938..27ebfd0 100644 --- a/test/udp_c.cpp +++ b/test/udp_c.cpp @@ -10,7 +10,7 @@ int main() { udp_client client(context); udp_client::endpoint endpoint(asio::ip::address_v4::from_string("127.0.0.1"), PORT); client.send_to("hello", endpoint, [&](const std::error_code& ec, std::size_t size) { - LOG("result: ec: %d, size: %lu", ec.value(), size); + LOG("result: ec: %d, size: %zu", ec.value(), size); }); context.run(); return EXIT_SUCCESS;