fix: string util

This commit is contained in:
2026-01-19 15:37:39 +01:00
parent 3564f4d653
commit 5874947381

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "memory.hpp" #include "memory.hpp"
#include <cstdarg>
#include <cstdint> #include <cstdint>
template <class Type, size_t n> template <class Type, size_t n>
@@ -29,7 +30,12 @@ namespace utils::string
while (true) while (true)
{ {
const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap); va_list ap_copy;
va_copy(ap_copy, ap);
const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap_copy);
va_end(ap_copy);
if (res > 0) break; // Success if (res > 0) break; // Success
if (res == 0) return nullptr; // Error if (res == 0) return nullptr; // Error