From e1232187879ad7c73283cb1279c63ff9ece89cc8 Mon Sep 17 00:00:00 2001 From: diamante0018 Date: Fri, 28 Nov 2025 23:24:58 +0100 Subject: [PATCH] fix VA --- .github/workflows/build.yml | 2 +- src/utils/string.hpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 434b5dc..83c0f26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ env: jobs: build-windows: name: Build Windows - runs-on: windows-2022 + runs-on: windows-2025 strategy: fail-fast: false matrix: diff --git a/src/utils/string.hpp b/src/utils/string.hpp index 8e2f729..dc666a6 100644 --- a/src/utils/string.hpp +++ b/src/utils/string.hpp @@ -28,16 +28,16 @@ namespace utils::string while (true) { -#ifdef _WIN32 - const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap); -#else const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap); -#endif + if (res < 0) return nullptr; // Error - if (res > 0) break; // Success - if (res == 0) return nullptr; // Error + if (static_cast(res) >= entry->size_) + { + entry->double_size(); + continue; + } - entry->double_size(); + break; // >= 0 Success } return entry->buffer_;