iw4x-client/iw4/Utils/Utils.cpp
2015-12-23 14:45:53 +01:00

27 lines
623 B
C++

#include "..\STDInclude.hpp"
#define VA_BUFFER_COUNT 4
#define VA_BUFFER_SIZE 4096
namespace Utils
{
const char *VA(const char *fmt, ...)
{
static char g_vaBuffer[VA_BUFFER_COUNT][VA_BUFFER_SIZE];
static int g_vaNextBufferIndex = 0;
va_list ap;
va_start(ap, fmt);
char* dest = g_vaBuffer[g_vaNextBufferIndex];
vsprintf_s(g_vaBuffer[g_vaNextBufferIndex], fmt, ap);
g_vaNextBufferIndex = (g_vaNextBufferIndex + 1) % VA_BUFFER_COUNT;
va_end(ap);
return dest;
}
std::string StrToLower(std::string input)
{
std::transform(input.begin(), input.end(), input.begin(), ::tolower);
return input;
}
}