Commit 2515c520 by Geoff Lang

Fix compile errors on pre-C++11 compilers.

BUG=angle:575 Change-Id: Ibad77fda193c850c29483aa56d0d2275c131429a Reviewed-on: https://chromium-review.googlesource.com/189163Tested-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent feee44bf
...@@ -30,15 +30,15 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c ...@@ -30,15 +30,15 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c
static std::vector<char> asciiMessageBuffer(512); static std::vector<char> asciiMessageBuffer(512);
// Attempt to just print to the current buffer // Attempt to just print to the current buffer
int len = std::vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg); int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size()) if (len < 0 || static_cast<size_t>(len) >= asciiMessageBuffer.size())
{ {
// Buffer was not large enough, calculate the required size and resize the buffer // Buffer was not large enough, calculate the required size and resize the buffer
len = std::vsnprintf(NULL, 0, format, vararg); len = vsnprintf(NULL, 0, format, vararg);
asciiMessageBuffer.resize(len + 1); asciiMessageBuffer.resize(len + 1);
// Print again // Print again
std::vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg); vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
} }
// NULL terminate the buffer to be safe // NULL terminate the buffer to be safe
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment