mirror of
https://github.com/diamante0018/master-tool.git
synced 2025-12-01 06:37:48 +00:00
fix(utils): fix VA function
This commit is contained in:
@@ -30,16 +30,16 @@ namespace utils
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap);
|
||||||
const int res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap);
|
if (res < 0) return nullptr; // Error
|
||||||
#else
|
|
||||||
const int res = vsnprintf(entry->buffer_, entry->size_, format, ap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (res > 0) break; // Success
|
|
||||||
if (res == 0) return nullptr; // Error
|
|
||||||
|
|
||||||
|
if (static_cast<std::size_t>(res) >= entry->size_)
|
||||||
|
{
|
||||||
entry->double_size();
|
entry->double_size();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break; // >= 0 Success
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry->buffer_;
|
return entry->buffer_;
|
||||||
|
|||||||
Reference in New Issue
Block a user