diff -r 895088452014 -r 08bfc3d9d2ae sources/mystring.cpp --- a/sources/mystring.cpp Tue May 26 18:19:27 2015 +0300 +++ b/sources/mystring.cpp Tue May 26 18:46:24 2015 +0300 @@ -31,7 +31,6 @@ #include #include "main.h" #include "mystring.h" -#include "format.h" #include "md5.h" // ------------------------------------------------------------------------------------------------- @@ -313,21 +312,29 @@ // ------------------------------------------------------------------------------------------------- // -void String::sprintf (const char* fmtstr, ...) +void __cdecl String::sprintf (const char* fmtstr, ...) +{ + va_list args; + va_start (args, fmtstr); + this->vsprintf (fmtstr, args); + va_end (args); +} + +// ------------------------------------------------------------------------------------------------- +// +void String::vsprintf (const char* fmtstr, va_list args) { char* buf = nullptr; int bufsize = 256; - va_list va; - va_start (va, fmtstr); do { + bufsize *= 2; delete[] buf; buf = new char[bufsize]; } - while (vsnprintf (buf, bufsize, fmtstr, va) >= bufsize); + while (vsnprintf (buf, bufsize, fmtstr, args) >= bufsize); - va_end (va); m_string = buf; delete[] buf; }