| 15 | base_exception::~base_exception() { } |
| 16 | |
| 17 | void base_exception::setMessage(const char* msg, std::va_list args) |
| 18 | { |
| 19 | std::va_list args2; |
| 20 | va_copy(args2, args); |
| 21 | int msglen{std::vsnprintf(nullptr, 0, msg, args)}; |
| 22 | if LIKELY(msglen > 0) |
| 23 | { |
| 24 | mMessage.resize(static_cast<size_t>(msglen)+1); |
| 25 | std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2); |
| 26 | mMessage.pop_back(); |
| 27 | } |
| 28 | va_end(args2); |
| 29 | } |
| 30 |