mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
The change to StringFromFormat was overwriting the last character with the NULL terminating character.
Also update a deprecated function call. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6374 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -54,13 +54,13 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
|
||||
std::string StringFromFormat(const char* format, ...)
|
||||
{
|
||||
int writtenCount = -1;
|
||||
size_t newSize = strlen(format) + 4;
|
||||
size_t newSize = strlen(format) + 5;
|
||||
char *buf = NULL;
|
||||
va_list args;
|
||||
while (writtenCount < 0)
|
||||
{
|
||||
delete[] buf;
|
||||
buf = new char[newSize + 1];
|
||||
buf = new char[newSize];
|
||||
|
||||
va_start(args, format);
|
||||
writtenCount = vsnprintf(buf, newSize, format, args);
|
||||
@ -71,7 +71,7 @@ std::string StringFromFormat(const char* format, ...)
|
||||
// Instead it returns the size of the string we need.
|
||||
if (writtenCount > (int)newSize)
|
||||
{
|
||||
newSize = writtenCount;
|
||||
newSize = writtenCount + 1;
|
||||
writtenCount = -1;
|
||||
}
|
||||
#else
|
||||
|
Reference in New Issue
Block a user