Commit c1e03a4b by Anton Danielsson

Changed "std::vsnprintf" to "vsnprintf" to be able to build with the android-ndk.

parent aecd7466
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <stdio.h>
#include "arraysize.h" #include "arraysize.h"
namespace benchmark { namespace benchmark {
...@@ -127,7 +129,7 @@ std::string StringPrintFImp(const char *msg, va_list args) ...@@ -127,7 +129,7 @@ std::string StringPrintFImp(const char *msg, va_list args)
// allocation guess what the size might be // allocation guess what the size might be
std::array<char, 256> local_buff; std::array<char, 256> local_buff;
std::size_t size = local_buff.size(); std::size_t size = local_buff.size();
auto ret = std::vsnprintf(local_buff.data(), size, msg, args_cp); auto ret = vsnprintf(local_buff.data(), size, msg, args_cp);
va_end(args_cp); va_end(args_cp);
...@@ -141,7 +143,7 @@ std::string StringPrintFImp(const char *msg, va_list args) ...@@ -141,7 +143,7 @@ std::string StringPrintFImp(const char *msg, va_list args)
// add 1 to size to account for null-byte in size cast to prevent overflow // add 1 to size to account for null-byte in size cast to prevent overflow
size = static_cast<std::size_t>(ret) + 1; size = static_cast<std::size_t>(ret) + 1;
auto buff_ptr = std::unique_ptr<char[]>(new char[size]); auto buff_ptr = std::unique_ptr<char[]>(new char[size]);
ret = std::vsnprintf(buff_ptr.get(), size, msg, args); ret = vsnprintf(buff_ptr.get(), size, msg, args);
return std::string(buff_ptr.get()); return std::string(buff_ptr.get());
} }
......
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