diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-05-05 23:52:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 23:52:14 +0200 |
commit | 57952505e522be868a5a8270d8670163b55ebade (patch) | |
tree | cf3c5544612b8a51075b498fa14dba8fe758d656 /Tools | |
parent | Require semi-colon at end of function-like macros (#4719) (diff) | |
download | cuberite-57952505e522be868a5a8270d8670163b55ebade.tar cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.gz cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.bz2 cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.lz cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.xz cuberite-57952505e522be868a5a8270d8670163b55ebade.tar.zst cuberite-57952505e522be868a5a8270d8670163b55ebade.zip |
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/GrownBiomeGenVisualiser/Globals.h | 2 | ||||
-rw-r--r-- | Tools/MCADefrag/Globals.h | 2 | ||||
-rw-r--r-- | Tools/NoiseSpeedTest/Globals.h | 2 | ||||
-rw-r--r-- | Tools/ProtoProxy/Connection.cpp | 22 | ||||
-rw-r--r-- | Tools/ProtoProxy/Connection.h | 18 | ||||
-rw-r--r-- | Tools/ProtoProxy/Globals.h | 2 |
6 files changed, 27 insertions, 21 deletions
diff --git a/Tools/GrownBiomeGenVisualiser/Globals.h b/Tools/GrownBiomeGenVisualiser/Globals.h index a920294cc..f2d0149ba 100644 --- a/Tools/GrownBiomeGenVisualiser/Globals.h +++ b/Tools/GrownBiomeGenVisualiser/Globals.h @@ -191,7 +191,7 @@ typedef unsigned char Byte; // Common headers (without macros): -#include "fmt/format.h" +#include "fmt.h" #include "StringUtils.h" diff --git a/Tools/MCADefrag/Globals.h b/Tools/MCADefrag/Globals.h index f8fd68b6a..058318de8 100644 --- a/Tools/MCADefrag/Globals.h +++ b/Tools/MCADefrag/Globals.h @@ -175,7 +175,7 @@ typedef unsigned char Byte; // Common headers (without macros): -#include "fmt/format.h" +#include "fmt.h" #include "StringUtils.h" #include "OSSupport/CriticalSection.h" #include "OSSupport/Event.h" diff --git a/Tools/NoiseSpeedTest/Globals.h b/Tools/NoiseSpeedTest/Globals.h index 23adeaf26..eb81d3552 100644 --- a/Tools/NoiseSpeedTest/Globals.h +++ b/Tools/NoiseSpeedTest/Globals.h @@ -184,7 +184,7 @@ typedef unsigned char Byte; // Common headers (without macros): -#include "fmt/format.h" +#include "fmt.h" #include "StringUtils.h" #include "OSSupport/CriticalSection.h" #include "OSSupport/Event.h" diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp index 51b94f2a2..3049826b6 100644 --- a/Tools/ProtoProxy/Connection.cpp +++ b/Tools/ProtoProxy/Connection.cpp @@ -284,16 +284,13 @@ void cConnection::Run(void) -void cConnection::Log(const char * a_Format, fmt::ArgList a_Args) +void cConnection::vLog(const char * a_Format, fmt::printf_args a_Args) { - fmt::MemoryWriter FullMsg; - fmt::printf(FullMsg, "[%5.3f] ", GetRelativeTime()); - fmt::printf(FullMsg, a_Format, a_Args); - fmt::printf(FullMsg, "\n"); - // Log to file: cCSLock Lock(m_CSLog); - fputs(FullMsg.c_str(), m_LogFile); + fmt::fprintf(m_LogFile, "[%5.3f] ", GetRelativeTime()); + fmt::vfprintf(m_LogFile, a_Format, a_Args); + fmt::fprintf(m_LogFile, "\n"); #ifdef _DEBUG fflush(m_LogFile); #endif // _DEBUG @@ -306,17 +303,16 @@ void cConnection::Log(const char * a_Format, fmt::ArgList a_Args) -void cConnection::DataLog(const void * a_Data, size_t a_Size, const char * a_Format, fmt::ArgList a_Args) +void cConnection::vDataLog(const void * a_Data, size_t a_Size, const char * a_Format, fmt::printf_args a_Args) { - fmt::MemoryWriter FullMsg; - fmt::printf(FullMsg, "[%5.3f] ", GetRelativeTime()); - fmt::printf(FullMsg, a_Format, a_Args); AString Hex; - fmt::printf(FullMsg, "\n%s\n", CreateHexDump(Hex, a_Data, a_Size, 16)); + CreateHexDump(Hex, a_Data, a_Size, 16); // Log to file: cCSLock Lock(m_CSLog); - fputs(FullMsg.c_str(), m_LogFile); + fmt::fprintf(m_LogFile, "[%5.3f] ", GetRelativeTime()); + fmt::vfprintf(m_LogFile, a_Format, a_Args); + fmt::fprintf(m_LogFile, "\n%s\n", Hex); /* // Log to screen: diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h index 3b9127530..e52e1fa6d 100644 --- a/Tools/ProtoProxy/Connection.h +++ b/Tools/ProtoProxy/Connection.h @@ -59,11 +59,21 @@ public: void Run(void); - void Log(const char * a_Format, fmt::ArgList); - FMT_VARIADIC(void, Log, const char *) + void vLog(const char * a_Format, fmt::printf_args); - void DataLog(const void * a_Data, size_t a_Size, const char * a_Format, fmt::ArgList); - FMT_VARIADIC(void, DataLog, const void *, size_t, const char *) + template <typename... Args> + void Log(const char * a_Format, const Args & ... a_Args) + { + vLog(a_Format, fmt::make_printf_args(a_Args...)); + } + + void vDataLog(const void * a_Data, size_t a_Size, const char * a_Format, fmt::printf_args); + + template <typename... Args> + void DataLog(const void * a_Data, size_t a_Size, const char * a_Format, const Args & ... a_Args) + { + vDataLog(a_Data, a_Size, a_Format, fmt::make_printf_args(a_Args...)); + } void LogFlush(void); diff --git a/Tools/ProtoProxy/Globals.h b/Tools/ProtoProxy/Globals.h index a2d0664b0..11e1fb7db 100644 --- a/Tools/ProtoProxy/Globals.h +++ b/Tools/ProtoProxy/Globals.h @@ -180,7 +180,7 @@ typedef unsigned char Byte; // Common headers (part 1, without macros): -#include "fmt/format.h" +#include "fmt.h" #include "StringUtils.h" #include "OSSupport/CriticalSection.h" |