CellSpurs initialization

This commit is contained in:
Nekotekina
2014-09-19 04:19:22 +04:00
parent df84e89d46
commit bb77249ac8
22 changed files with 599 additions and 272 deletions
+9 -1
View File
@@ -13,13 +13,21 @@
#endif
template<size_t size>
void strcpy_trunc(char (&dst)[size], const std::string& src)
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;
}
template<size_t size, size_t rsize>
void strcpy_trunc(char(&dst)[size], const char(&src)[rsize])
{
const size_t count = (rsize >= size) ? size - 1 /* truncation */ : rsize;
memcpy(dst, src, count);
dst[count] = 0;
}
#if defined(__GNUG__)
#include <cmath>
#include <stdlib.h>