You've already forked openal-soft
mirror of
https://github.com/OldUnreal/openal-soft.git
synced 2026-04-02 21:38:01 -07:00
Note that GCC's va_list seems to be implemented as some type with an array size of 1 (__va_list_tag[1]), which is expected to implicitly decay to a pointer when passed as a parameter. This unfortunately necessitates NOLINTBEGIN/END where it's used to silence clang-tidy.
33 lines
673 B
C++
33 lines
673 B
C++
|
|
#include "config.h"
|
|
|
|
#include "except.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstdarg>
|
|
|
|
#include "opthelpers.h"
|
|
|
|
|
|
namespace al {
|
|
|
|
base_exception::~base_exception() = default;
|
|
|
|
void base_exception::setMessage(const char *msg, std::va_list args)
|
|
{
|
|
/* NOLINTBEGIN(*-array-to-pointer-decay) */
|
|
std::va_list args2;
|
|
va_copy(args2, args);
|
|
int msglen{std::vsnprintf(nullptr, 0, msg, args)};
|
|
if(msglen > 0) LIKELY
|
|
{
|
|
mMessage.resize(static_cast<size_t>(msglen)+1);
|
|
std::vsnprintf(mMessage.data(), mMessage.length(), msg, args2);
|
|
mMessage.pop_back();
|
|
}
|
|
va_end(args2);
|
|
/* NOLINTEND(*-array-to-pointer-decay) */
|
|
}
|
|
|
|
} // namespace al
|