From 4b2dde59dd6d53f51bf39e664586c920b17a3543 Mon Sep 17 00:00:00 2001 From: uchenily Date: Thu, 16 May 2024 16:50:33 +0800 Subject: [PATCH] fix ci windows --- benchmark/benchmark.md | 8 ++++---- uvio/io/buffer.hpp | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/benchmark/benchmark.md b/benchmark/benchmark.md index 23bed38..5fa1650 100644 --- a/benchmark/benchmark.md +++ b/benchmark/benchmark.md @@ -2,10 +2,10 @@ ## 测试环境 -cpu: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz -kernel: 6.8.8-arch1-1 -gcc: (GCC) 14.1.1 20240507 -wrk: 4.2.0 [epoll] Copyright (C) 2012 Will Glozer +- cpu: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz +- kernel: 6.8.8-arch1-1 +- gcc: (GCC) 14.1.1 20240507 +- wrk: 4.2.0 [epoll] Copyright (C) 2012 Will Glozer ```shell diff --git a/uvio/io/buffer.hpp b/uvio/io/buffer.hpp index 28bd32f..34cf1e5 100644 --- a/uvio/io/buffer.hpp +++ b/uvio/io/buffer.hpp @@ -62,8 +62,9 @@ class StreamBuffer { } auto write_to(std::span dst) noexcept -> std::size_t { - auto len = std::min(static_cast(r_remaining()), - dst.size_bytes()); + // MSVC处理\n换行有bug, std::min只能放到同一行 + auto n_readable = static_cast(r_remaining()); + auto len = std::min(n_readable, dst.size_bytes()); std::copy_n(r_begin(), len, dst.begin()); r_increase(len); if (r_pos_ == w_pos_) { @@ -73,8 +74,9 @@ class StreamBuffer { } auto read_from(std::span src) noexcept -> std::size_t { - auto len = std::min(static_cast(w_remaining()), - src.size_bytes()); + // MSVC处理\n换行有bug, std::min只能放到同一行 + auto n_writable = static_cast(w_remaining()); + auto len = std::min(n_writable, src.size_bytes()); std::copy_n(src.begin(), len, w_begin()); w_increase(len); return len;