Codechange: replace puts with fmt::print

pull/564/head
Rubidium 1 year ago committed by rubidium42
parent 275ebf4509
commit 411379f587

@ -138,8 +138,7 @@ void DebugPrint(const char *level, const std::string &message)
fflush(f);
#endif
} else {
std::string msg = fmt::format("{}dbg: [{}] {}\n", GetLogPrefix(), level, message);
fputs(msg.c_str(), stderr);
fmt::print(stderr, "{}dbg: [{}] {}\n", GetLogPrefix(), level, message);
if (_debug_remote_console.load()) {
/* Only add to the queue when there is at least one consumer of the data. */

@ -109,9 +109,9 @@ uint32 NewGRFProfiler::Finish()
uint32 total_microseconds = 0;
fputs("Tick,Sprite,Feature,Item,CallbackID,Microseconds,Depth,Result\n", f);
fmt::print(f, "Tick,Sprite,Feature,Item,CallbackID,Microseconds,Depth,Result\n");
for (const Call &c : this->calls) {
fputs(fmt::format("{},{},{:#X},{},{:#X},{},{},{}\n", c.tick, c.root_sprite, c.feat, c.item, (uint)c.cb, c.time, c.subs, c.result).c_str(), f);
fmt::print(f, "{},{},{:#X},{},{:#X},{},{},{}\n", c.tick, c.root_sprite, c.feat, c.item, (uint)c.cb, c.time, c.subs, c.result);
total_microseconds += c.time;
}

@ -456,11 +456,11 @@ int CDECL main(int argc, char *argv[])
switch (i) {
case 'v':
puts("$Revision$");
fmt::print("$Revision$\n");
return 0;
case 'h':
puts("settingsgen - $Revision$\n"
fmt::print("settingsgen - $Revision$\n"
"Usage: settingsgen [options] ini-file...\n"
"with options:\n"
" -v, --version Print version information and exit\n"

@ -423,7 +423,7 @@ int CDECL main(int argc, char *argv[])
switch (i) {
case 'v':
puts("$Revision$");
fmt::print("$Revision$\n");
return 0;
case 'C':
@ -467,7 +467,7 @@ int CDECL main(int argc, char *argv[])
break;
case 'h':
puts(
fmt::print(
"strgen - $Revision$\n"
" -v | --version print version information and exit\n"
" -t | --todo replace any untranslated strings with '<TODO>'\n"
@ -480,7 +480,7 @@ int CDECL main(int argc, char *argv[])
" -export-pragmas export all pragmas and exit\n"
" Run without parameters and strgen will search for english.txt and parse it,\n"
" creating strings.h. Passing an argument, strgen will translate that language\n"
" file using english.txt as a reference and output <language>.lng."
" file using english.txt as a reference and output <language>.lng.\n"
);
return 0;

Loading…
Cancel
Save