mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-28 20:58:35 +01:00
Fixed various potential bugs and compiler warnings
This commit is contained in:
1 parent
03eacd1af3
commit
b780e39397
10 files changed
+62
-40
No files matched your search
+10
-5
@@ -55,25 +55,30 @@ std::string StringFromFormat(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *buf = NULL;
|
||||
std::string temp = "";
|
||||
#ifdef _WIN32
|
||||
int required = 0;
|
||||
|
||||
va_start(args, format);
|
||||
required = _vscprintf(format, args);
|
||||
buf = new char[required + 1];
|
||||
vsnprintf(buf, required, format, args);
|
||||
if(vsnprintf(buf, required, format, args) < 0)
|
||||
buf[0] = '\0';
|
||||
va_end(args);
|
||||
|
||||
buf[required] = '\0';
|
||||
std::string temp = buf;
|
||||
temp = buf;
|
||||
delete[] buf;
|
||||
#else
|
||||
va_start(args, format);
|
||||
vasprintf(&buf, format, args);
|
||||
if(vasprintf(&buf, format, args) < 0)
|
||||
buf = NULL;
|
||||
va_end(args);
|
||||
|
||||
std::string temp = buf;
|
||||
free(buf);
|
||||
if(buf != NULL) {
|
||||
temp = buf;
|
||||
free(buf);
|
||||
}
|
||||
#endif
|
||||
return temp;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user