mirror of
https://github.com/diamante0018/master-tool.git
synced 2025-11-30 22:27:48 +00:00
fix: copy va
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "memory.hpp"
|
||||
#include <cstdarg>
|
||||
|
||||
template <class Type, std::size_t n>
|
||||
constexpr auto ARRAY_COUNT(Type(&)[n]) { return n; }
|
||||
@@ -30,7 +31,12 @@ namespace utils
|
||||
|
||||
while (true)
|
||||
{
|
||||
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap);
|
||||
va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
|
||||
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap_copy);
|
||||
va_end(ap_copy);
|
||||
|
||||
if (res < 0) return nullptr; // Error
|
||||
|
||||
if (static_cast<std::size_t>(res) >= entry->size_)
|
||||
|
||||
Reference in New Issue
Block a user