gs-helper: Fix nonstandard usage of va_start

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-12-21 18:07:08 +01:00
parent 624bdda6a3
commit 1d9a4ddbf5
2 changed files with 4 additions and 4 deletions

View file

@ -34,14 +34,14 @@ gs::context::~context()
gs_debug_marker_begin(color, _name.c_str()); gs_debug_marker_begin(color, _name.c_str());
}*/ }*/
gs::debug_marker::debug_marker(const float color[4], std::string format, ...) gs::debug_marker::debug_marker(const float color[4], const char* format, ...)
{ {
size_t size; size_t size;
std::vector<char> buffer(64); std::vector<char> buffer(128);
va_list vargs; va_list vargs;
va_start(vargs, format); va_start(vargs, format);
size = vsnprintf(buffer.data(), buffer.size(), format.c_str(), vargs); size = static_cast<size_t>(vsnprintf(buffer.data(), buffer.size(), format, vargs));
va_end(vargs); va_end(vargs);
_name = std::string(buffer.data(), buffer.data() + size); _name = std::string(buffer.data(), buffer.data() + size);

View file

@ -50,7 +50,7 @@ namespace gs {
public: public:
//debug_marker(const float color[4], std::string name); //debug_marker(const float color[4], std::string name);
debug_marker(const float color[4], std::string format, ...); debug_marker(const float color[4], const char* format, ...);
~debug_marker(); ~debug_marker();
}; };
} // namespace gs } // namespace gs