From cf6854ce08bc87ce9f3440787aa3ef594c29b375 Mon Sep 17 00:00:00 2001 From: lichunjun Date: Mon, 6 Feb 2023 18:37:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/log/file_async_channel.cpp | 4 ++-- modules/util/json.h | 1 + modules/util/json_deep_loader.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/log/file_async_channel.cpp b/modules/log/file_async_channel.cpp index 1324ae3..9f82b59 100644 --- a/modules/log/file_async_channel.cpp +++ b/modules/log/file_async_channel.cpp @@ -65,8 +65,8 @@ void FileAsyncChannel::onLogBackEnd(const void *data_ptr, size_t data_size) return; const char *start_ptr = static_cast(data_ptr); - if (buffer_.size() < (data_size + 1)) - buffer_.resize(data_size + 1); + if (buffer_.size() < data_size) + buffer_.resize(data_size); std::transform(start_ptr, start_ptr + data_size, buffer_.begin(), [](char ch) { return ch == 0 ? '\n' : ch; } diff --git a/modules/util/json.h b/modules/util/json.h index dfb6689..0816784 100644 --- a/modules/util/json.h +++ b/modules/util/json.h @@ -1,6 +1,7 @@ #ifndef TBOX_UTIL_JSON_H_20220908 #define TBOX_UTIL_JSON_H_20220908 +#include #include namespace tbox { diff --git a/modules/util/json_deep_loader.h b/modules/util/json_deep_loader.h index 273788a..f74b415 100644 --- a/modules/util/json_deep_loader.h +++ b/modules/util/json_deep_loader.h @@ -61,6 +61,7 @@ * */ +#include #include namespace tbox { -- Gitee