Various warning fixes and devirtualization

* Remove ArrayString
* devirtualize GetCount and SetCount, they're no longer needed
* set storage duration of fmt::placeholder to extern to be consistent
* make length unsigned and the return value of sprintf signed
* remove dead code "s.Close()" is never reached
* devirtualize WrteToLog()
* devirtualize Ini functions
This commit is contained in:
Peter Tissen 2014-04-08 19:29:17 +02:00
parent 1975b7e139
commit 4066950975
6 changed files with 21 additions and 113 deletions

View file

@ -1,20 +1,20 @@
#include "stdafx.h"
#include "StrFmt.h"
static const std::string fmt::placeholder = "???";
extern const std::string fmt::placeholder = "???";
//wrapper to deal with advance sprintf formating options with automatic length finding
//can't take strings by reference because of "va_start", so overload it with char *
std::string fmt::FormatV(const char *fmt, va_list args)
{
int length = 256;
size_t length = 256;
std::string str;
for (;;)
{
std::vector<char> buffptr(length);
size_t printlen = vsnprintf(buffptr.data(), length, fmt, args);
int printlen = vsnprintf(buffptr.data(), length, fmt, args);
if (printlen >= 0 && printlen < length)
{
str = std::string(buffptr.data(), printlen);