mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make Console::Write functions atomic
This commit is contained in:
parent
7da60f4950
commit
dd58a710ee
|
@ -15,6 +15,7 @@
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "Console.hpp"
|
#include "Console.hpp"
|
||||||
#include "../platform/platform.h"
|
#include "../platform/platform.h"
|
||||||
|
@ -33,10 +34,8 @@ namespace Console
|
||||||
|
|
||||||
void WriteSpace(size_t count)
|
void WriteSpace(size_t count)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < count; i++)
|
std::string sz(count, ' ');
|
||||||
{
|
Write(sz.c_str());
|
||||||
Write(' ');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteFormat(const utf8 * format, ...)
|
void WriteFormat(const utf8 * format, ...)
|
||||||
|
@ -58,8 +57,8 @@ namespace Console
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vfprintf(stdout, format, args);
|
auto formatLn = std::string(format) + "\n";
|
||||||
puts("");
|
vfprintf(stdout, formatLn.c_str(), args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +98,8 @@ namespace Console
|
||||||
|
|
||||||
void WriteLine_VA(const utf8 * format, va_list args)
|
void WriteLine_VA(const utf8 * format, va_list args)
|
||||||
{
|
{
|
||||||
vfprintf(stdout, format, args);
|
auto formatLn = std::string(format) + "\n";
|
||||||
puts("");
|
vfprintf(stdout, formatLn.c_str(), args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue