1
0
Fork 0

Fixed more Format issues

This commit is contained in:
Tycho 2014-03-11 14:43:14 -07:00
parent 16b27c4b7a
commit 7e6ee7ef81
6 changed files with 17 additions and 17 deletions

View File

@ -459,7 +459,7 @@ bool cByteBuffer::ReadVarUTF8String(AString & a_Value)
} }
if (Size > MAX_STRING_SIZE) if (Size > MAX_STRING_SIZE)
{ {
LOGWARNING("%s: String too large: %llu (%llu KiB)", __FUNCTION__, Size, Size / 1024); LOGWARNING("%s: String too large: %u (%u KiB)", __FUNCTION__, Size, Size / 1024);
} }
return ReadString(a_Value, (int)Size); return ReadString(a_Value, (int)Size);
} }

View File

@ -21,10 +21,10 @@ public: // tolua_export
~cMCLogger(); // tolua_export ~cMCLogger(); // tolua_export
void Log(const char* a_Format, va_list a_ArgList); void Log(const char* a_Format, va_list a_ArgList) FORMATSTRING(2,0);
void Info(const char* a_Format, va_list a_ArgList); void Info(const char* a_Format, va_list a_ArgList) FORMATSTRING(2,0);
void Warn(const char* a_Format, va_list a_ArgList); void Warn(const char* a_Format, va_list a_ArgList) FORMATSTRING(2,0);
void Error(const char* a_Format, va_list a_ArgList); void Error(const char* a_Format, va_list a_ArgList) FORMATSTRING(2,0);
void LogSimple(const char* a_Text, int a_LogType = 0 ); // tolua_export void LogSimple(const char* a_Text, int a_LogType = 0 ); // tolua_export
@ -57,9 +57,9 @@ private:
extern void LOG(const char* a_Format, ...) FORMATSTRING(1,2); extern void LOG(const char* a_Format, ...) FORMATSTRING(1,2);
extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1,2); extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1,2);
extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1,2); extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1,2);
extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1,2); extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1,2);

View File

@ -778,11 +778,11 @@ void cRoot::LogChunkStats(cCommandOutputCallback & a_Output)
int Mem = NumValid * sizeof(cChunk); int Mem = NumValid * sizeof(cChunk);
a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (Mem + 1023) / 1024, (Mem + 1024 * 1024 - 1) / (1024 * 1024)); a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (Mem + 1023) / 1024, (Mem + 1024 * 1024 - 1) / (1024 * 1024));
a_Output.Out(" Per-chunk memory size breakdown:"); a_Output.Out(" Per-chunk memory size breakdown:");
a_Output.Out(" block types: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockTypes), (sizeof(cChunkDef::BlockTypes) + 1023) / 1024); a_Output.Out(" block types: %6zu bytes (%3zu KiB)", sizeof(cChunkDef::BlockTypes), (sizeof(cChunkDef::BlockTypes) + 1023) / 1024);
a_Output.Out(" block metadata: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockNibbles), (sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); a_Output.Out(" block metadata: %6zu bytes (%3zu KiB)", sizeof(cChunkDef::BlockNibbles), (sizeof(cChunkDef::BlockNibbles) + 1023) / 1024);
a_Output.Out(" block lighting: %6d bytes (%3d KiB)", 2 * sizeof(cChunkDef::BlockNibbles), (2 * sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); a_Output.Out(" block lighting: %6zu bytes (%3zu KiB)", 2 * sizeof(cChunkDef::BlockNibbles), (2 * sizeof(cChunkDef::BlockNibbles) + 1023) / 1024);
a_Output.Out(" heightmap: %6d bytes (%3d KiB)", sizeof(cChunkDef::HeightMap), (sizeof(cChunkDef::HeightMap) + 1023) / 1024); a_Output.Out(" heightmap: %6zu bytes (%3zu KiB)", sizeof(cChunkDef::HeightMap), (sizeof(cChunkDef::HeightMap) + 1023) / 1024);
a_Output.Out(" biomemap: %6d bytes (%3d KiB)", sizeof(cChunkDef::BiomeMap), (sizeof(cChunkDef::BiomeMap) + 1023) / 1024); a_Output.Out(" biomemap: %6zu bytes (%3zu KiB)", sizeof(cChunkDef::BiomeMap), (sizeof(cChunkDef::BiomeMap) + 1023) / 1024);
int Rest = sizeof(cChunk) - sizeof(cChunkDef::BlockTypes) - 3 * sizeof(cChunkDef::BlockNibbles) - sizeof(cChunkDef::HeightMap) - sizeof(cChunkDef::BiomeMap); int Rest = sizeof(cChunk) - sizeof(cChunkDef::BlockTypes) - 3 * sizeof(cChunkDef::BlockNibbles) - sizeof(cChunkDef::HeightMap) - sizeof(cChunkDef::BiomeMap);
a_Output.Out(" other: %6d bytes (%3d KiB)", Rest, (Rest + 1023) / 1024); a_Output.Out(" other: %6d bytes (%3d KiB)", Rest, (Rest + 1023) / 1024);
SumNumValid += NumValid; SumNumValid += NumValid;

View File

@ -550,7 +550,7 @@ void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback &
for (AStringPairs::const_iterator itr = Callback.m_Commands.begin(), end = Callback.m_Commands.end(); itr != end; ++itr) for (AStringPairs::const_iterator itr = Callback.m_Commands.begin(), end = Callback.m_Commands.end(); itr != end; ++itr)
{ {
const AStringPair & cmd = *itr; const AStringPair & cmd = *itr;
a_Output.Out(Printf("%-*s%s\n", Callback.m_MaxLen, cmd.first.c_str(), cmd.second.c_str())); a_Output.Out(Printf("%-*s%s\n", static_cast<int>(Callback.m_MaxLen), cmd.first.c_str(), cmd.second.c_str()));
} // for itr - Callback.m_Commands[] } // for itr - Callback.m_Commands[]
a_Output.Finished(); a_Output.Finished();
} }

View File

@ -31,7 +31,7 @@ extern AString & Printf (AString & str, const char * format, ...) FORMATST
extern AString Printf(const char * format, ...) FORMATSTRING(1,2); extern AString Printf(const char * format, ...) FORMATSTRING(1,2);
/// Add the formatted string to the existing data in the string /// Add the formatted string to the existing data in the string
extern AString & AppendPrintf (AString & str, const char * format, ...); extern AString & AppendPrintf (AString & str, const char * format, ...) FORMATSTRING(2,3);
/// Split the string at any of the listed delimiters, return as a stringvector /// Split the string at any of the listed delimiters, return as a stringvector
extern AStringVector StringSplit(const AString & str, const AString & delim); extern AStringVector StringSplit(const AString & str, const AString & delim);

View File

@ -103,7 +103,7 @@ protected:
{ {
for (;;) for (;;)
{ {
LOG("%d chunks to load, %d chunks to generate", LOG("%zu chunks to load, %d chunks to generate",
m_World->GetStorage().GetLoadQueueLength(), m_World->GetStorage().GetLoadQueueLength(),
m_World->GetGenerator().GetQueueLength() m_World->GetGenerator().GetQueueLength()
); );
@ -155,7 +155,7 @@ protected:
{ {
for (;;) for (;;)
{ {
LOG("%d chunks remaining to light", m_Lighting->GetQueueLength() LOG("%zu chunks remaining to light", m_Lighting->GetQueueLength()
); );
// Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish // Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish