Compilation fix

This commit is contained in:
Nekotekina 2014-07-01 19:34:25 +04:00
parent f3b61f58ef
commit 2eeab1feb0
3 changed files with 23 additions and 15 deletions

View file

@ -6,6 +6,14 @@
#define thread_local __thread
#endif
template<size_t size>
void strcpy_trunc(char (&dst)[size], const std::string& src)
{
const size_t count = (src.size() >= size) ? size - 1 /* truncation */ : src.size();
memcpy(dst, src.c_str(), count);
dst[count] = 0;
}
#if defined(__GNUG__)
#include <cmath>
#include <stdlib.h>