mirror of
https://github.com/alterware/master-server.git
synced 2025-12-08 10:37:48 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
07f54e71bd
|
|||
|
3231438f20
|
|||
| fd5b0da1af | |||
| 638f83694b | |||
|
|
0feed9adaf | ||
|
|
83c16a1b8c | ||
| 2554b7fd3c | |||
|
|
3f1c3acb57 |
2
deps/GSL
vendored
2
deps/GSL
vendored
Submodule deps/GSL updated: 7e0943d20d...543d0dd3fe
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
Submodule deps/libtomcrypt updated: 5edb54e522...a3cc5bf623
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "memory.hpp"
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
|
||||
template <class Type, std::size_t n>
|
||||
@@ -29,12 +30,21 @@ namespace utils::string
|
||||
|
||||
while (true)
|
||||
{
|
||||
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap);
|
||||
va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
|
||||
if (res > 0) break; // Success
|
||||
if (res == 0) return nullptr; // Error
|
||||
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap_copy);
|
||||
va_end(ap_copy);
|
||||
|
||||
entry->double_size();
|
||||
if (res < 0) return nullptr; // Error
|
||||
|
||||
if (static_cast<std::size_t>(res) >= entry->size_)
|
||||
{
|
||||
entry->double_size();
|
||||
continue;
|
||||
}
|
||||
|
||||
break; // Success
|
||||
}
|
||||
|
||||
return entry->buffer_;
|
||||
|
||||
Reference in New Issue
Block a user