Fixed a load of format string errors
This commit is contained in:
parent
a19f5fc484
commit
16b27c4b7a
@ -1281,7 +1281,9 @@ void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header)
|
|||||||
{
|
{
|
||||||
UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns
|
UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns
|
||||||
|
|
||||||
LOGD((a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
|
|
||||||
|
// Format string consisting only of %s is used to appease the compiler
|
||||||
|
LOGD("%s",(a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
|
||||||
for (int i = lua_gettop(a_LuaState); i > 0; i--)
|
for (int i = lua_gettop(a_LuaState); i > 0; i--)
|
||||||
{
|
{
|
||||||
AString Value;
|
AString Value;
|
||||||
|
@ -882,7 +882,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
|
|||||||
LOGD("Prevented a dig/aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)",
|
LOGD("Prevented a dig/aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)",
|
||||||
a_BlockX, a_BlockY, a_BlockZ,
|
a_BlockX, a_BlockY, a_BlockZ,
|
||||||
m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ,
|
m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ,
|
||||||
m_HasStartedDigging
|
(m_HasStartedDigging ? "True" : "False")
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ void cLogCommandOutputCallback::Finished(void)
|
|||||||
{
|
{
|
||||||
case '\n':
|
case '\n':
|
||||||
{
|
{
|
||||||
LOG(m_Buffer.substr(last, i - last).c_str());
|
LOG("%s",m_Buffer.substr(last, i - last).c_str());
|
||||||
last = i + 1;
|
last = i + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ void cLogCommandOutputCallback::Finished(void)
|
|||||||
} // for i - m_Buffer[]
|
} // for i - m_Buffer[]
|
||||||
if (last < len)
|
if (last < len)
|
||||||
{
|
{
|
||||||
LOG(m_Buffer.substr(last).c_str());
|
LOG("%s",m_Buffer.substr(last).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the buffer for the next command output:
|
// Clear the buffer for the next command output:
|
||||||
|
@ -340,7 +340,7 @@ void cCraftingRecipes::LoadRecipes(void)
|
|||||||
}
|
}
|
||||||
AddRecipeLine(LineNum, Recipe);
|
AddRecipeLine(LineNum, Recipe);
|
||||||
} // for itr - Split[]
|
} // for itr - Split[]
|
||||||
LOG("Loaded %d crafting recipes", m_Recipes.size());
|
LOG("Loaded %zu crafting recipes", m_Recipes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ void cFurnaceRecipe::ReloadRecipes(void)
|
|||||||
{
|
{
|
||||||
LOGERROR("ERROR: FurnaceRecipe, syntax error" );
|
LOGERROR("ERROR: FurnaceRecipe, syntax error" );
|
||||||
}
|
}
|
||||||
LOG("Loaded %u furnace recipes and %u fuels", m_pState->Recipes.size(), m_pState->Fuel.size());
|
LOG("Loaded %zu furnace recipes and %zu fuels", m_pState->Recipes.size(), m_pState->Fuel.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_Chunk
|
|||||||
// Add to queue, issue a warning if too many:
|
// Add to queue, issue a warning if too many:
|
||||||
if (m_Queue.size() >= QUEUE_WARNING_LIMIT)
|
if (m_Queue.size() >= QUEUE_WARNING_LIMIT)
|
||||||
{
|
{
|
||||||
LOGWARN("WARNING: Adding chunk [%i, %i] to generation queue; Queue is too big! (%i)", a_ChunkX, a_ChunkZ, m_Queue.size());
|
LOGWARN("WARNING: Adding chunk [%i, %i] to generation queue; Queue is too big! (%zu)", a_ChunkX, a_ChunkZ, m_Queue.size());
|
||||||
}
|
}
|
||||||
m_Queue.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ));
|
m_Queue.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ));
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ BLOCKTYPE cChunkGenerator::GetIniBlock(cIniFile & a_IniFile, const AString & a_S
|
|||||||
BLOCKTYPE Block = BlockStringToType(BlockType);
|
BLOCKTYPE Block = BlockStringToType(BlockType);
|
||||||
if (Block < 0)
|
if (Block < 0)
|
||||||
{
|
{
|
||||||
LOGWARN("[&s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str());
|
LOGWARN("[%s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str());
|
||||||
return BlockStringToType(a_Default);
|
return BlockStringToType(a_Default);
|
||||||
}
|
}
|
||||||
return Block;
|
return Block;
|
||||||
|
@ -216,7 +216,7 @@ cItem * cItems::Get(int a_Idx)
|
|||||||
{
|
{
|
||||||
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
||||||
{
|
{
|
||||||
LOGWARNING("cItems: Attempt to get an out-of-bounds item at index %d; there are currently %d items. Returning a nil.", a_Idx, size());
|
LOGWARNING("cItems: Attempt to get an out-of-bounds item at index %d; there are currently %zu items. Returning a nil.", a_Idx, size());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return &at(a_Idx);
|
return &at(a_Idx);
|
||||||
@ -230,7 +230,7 @@ void cItems::Set(int a_Idx, const cItem & a_Item)
|
|||||||
{
|
{
|
||||||
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
||||||
{
|
{
|
||||||
LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size());
|
LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %zu items. Not setting.", a_Idx, size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
at(a_Idx) = a_Item;
|
at(a_Idx) = a_Item;
|
||||||
@ -244,7 +244,7 @@ void cItems::Delete(int a_Idx)
|
|||||||
{
|
{
|
||||||
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
||||||
{
|
{
|
||||||
LOGWARNING("cItems: Attempt to delete an item at an out-of-bounds index %d; there are currently %d items. Ignoring.", a_Idx, size());
|
LOGWARNING("cItems: Attempt to delete an item at an out-of-bounds index %d; there are currently %zu items. Ignoring.", a_Idx, size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
erase(begin() + a_Idx);
|
erase(begin() + a_Idx);
|
||||||
@ -258,7 +258,7 @@ void cItems::Set(int a_Idx, short a_ItemType, char a_ItemCount, short a_ItemDama
|
|||||||
{
|
{
|
||||||
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
if ((a_Idx < 0) || (a_Idx >= (int)size()))
|
||||||
{
|
{
|
||||||
LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size());
|
LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %zu items. Not setting.", a_Idx, size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemDamage);
|
at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemDamage);
|
||||||
|
@ -57,10 +57,10 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern void LOG(const char* a_Format, ...);
|
extern void LOG(const char* a_Format, ...) FORMATSTRING(1,2);
|
||||||
extern void LOGINFO(const char* a_Format, ...);
|
extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1,2);
|
||||||
extern void LOGWARN(const char* a_Format, ...);
|
extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1,2);
|
||||||
extern void LOGERROR(const char* a_Format, ...);
|
extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1,2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ bool cSocketThreads::AddClient(const cSocket & a_Socket, cCallback * a_Client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No thread has free space, create a new one:
|
// No thread has free space, create a new one:
|
||||||
LOGD("Creating a new cSocketThread (currently have %d)", m_Threads.size());
|
LOGD("Creating a new cSocketThread (currently have %zu)", m_Threads.size());
|
||||||
cSocketThread * Thread = new cSocketThread(this);
|
cSocketThread * Thread = new cSocketThread(this);
|
||||||
if (!Thread->Start())
|
if (!Thread->Start())
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,7 @@ cProtocol132::~cProtocol132()
|
|||||||
{
|
{
|
||||||
if (!m_DataToSend.empty())
|
if (!m_DataToSend.empty())
|
||||||
{
|
{
|
||||||
LOGD("There are %d unsent bytes while deleting cProtocol132", m_DataToSend.size());
|
LOGD("There are %zu unsent bytes while deleting cProtocol132", m_DataToSend.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,7 +1344,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, int a_Size)
|
|||||||
if (bb.GetReadableSpace() != 1)
|
if (bb.GetReadableSpace() != 1)
|
||||||
{
|
{
|
||||||
// Read more or less than packet length, report as error
|
// Read more or less than packet length, report as error
|
||||||
LOGWARNING("Protocol 1.7: Wrong number of bytes read for packet 0x%x, state %d. Read %u bytes, packet contained %u bytes",
|
LOGWARNING("Protocol 1.7: Wrong number of bytes read for packet 0x%x, state %d. Read %zu bytes, packet contained %u bytes",
|
||||||
PacketType, m_State, bb.GetUsedSpace() - bb.GetReadableSpace(), PacketLen
|
PacketType, m_State, bb.GetUsedSpace() - bb.GetReadableSpace(), PacketLen
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2062,7 +2062,7 @@ void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata)
|
|||||||
{
|
{
|
||||||
AString HexDump;
|
AString HexDump;
|
||||||
CreateHexDump(HexDump, a_Metadata.data(), a_Metadata.size(), 16);
|
CreateHexDump(HexDump, a_Metadata.data(), a_Metadata.size(), 16);
|
||||||
LOGWARNING("Cannot unGZIP item metadata (%u bytes):\n%s", a_Metadata.size(), HexDump.c_str());
|
LOGWARNING("Cannot unGZIP item metadata (%zu bytes):\n%s", a_Metadata.size(), HexDump.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2072,7 +2072,7 @@ void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata)
|
|||||||
{
|
{
|
||||||
AString HexDump;
|
AString HexDump;
|
||||||
CreateHexDump(HexDump, Uncompressed.data(), Uncompressed.size(), 16);
|
CreateHexDump(HexDump, Uncompressed.data(), Uncompressed.size(), 16);
|
||||||
LOGWARNING("Cannot parse NBT item metadata: (%u bytes)\n%s", Uncompressed.size(), HexDump.c_str());
|
LOGWARNING("Cannot parse NBT item metadata: (%zu bytes)\n%s", Uncompressed.size(), HexDump.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int
|
|||||||
{
|
{
|
||||||
if ((size_t)(a_Item.m_ItemCount) < a_SlotNums.size())
|
if ((size_t)(a_Item.m_ItemCount) < a_SlotNums.size())
|
||||||
{
|
{
|
||||||
LOGWARNING("%s: Distributing less items (%d) than slots (%u)", __FUNCTION__, (int)a_Item.m_ItemCount, a_SlotNums.size());
|
LOGWARNING("%s: Distributing less items (%d) than slots (%zu)", __FUNCTION__, (int)a_Item.m_ItemCount, a_SlotNums.size());
|
||||||
// This doesn't seem to happen with the 1.5.1 client, so we don't worry about it for now
|
// This doesn't seem to happen with the 1.5.1 client, so we don't worry about it for now
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
|
|||||||
|
|
||||||
if( ChunksConverted % 32 == 0 )
|
if( ChunksConverted % 32 == 0 )
|
||||||
{
|
{
|
||||||
LOGINFO("Updating \"%s\" version 1 to version 2: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
|
LOGINFO("Updating \"%s\" version 1 to version 2: %zu %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
|
||||||
}
|
}
|
||||||
ChunksConverted++;
|
ChunksConverted++;
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
|
|||||||
|
|
||||||
if (UncompressedSize != (int)UncompressedData.size())
|
if (UncompressedSize != (int)UncompressedData.size())
|
||||||
{
|
{
|
||||||
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]",
|
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %zu) for chunk [%d, %d]",
|
||||||
UncompressedSize, UncompressedData.size(),
|
UncompressedSize, UncompressedData.size(),
|
||||||
Header->m_ChunkX, Header->m_ChunkZ
|
Header->m_ChunkX, Header->m_ChunkZ
|
||||||
);
|
);
|
||||||
@ -713,7 +713,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
|
|||||||
|
|
||||||
if( ChunksConverted % 32 == 0 )
|
if( ChunksConverted % 32 == 0 )
|
||||||
{
|
{
|
||||||
LOGINFO("Updating \"%s\" version 2 to version 3: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
|
LOGINFO("Updating \"%s\" version 2 to version 3: %zu %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
|
||||||
}
|
}
|
||||||
ChunksConverted++;
|
ChunksConverted++;
|
||||||
|
|
||||||
@ -751,7 +751,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
|
|||||||
|
|
||||||
if (UncompressedSize != (int)UncompressedData.size())
|
if (UncompressedSize != (int)UncompressedData.size())
|
||||||
{
|
{
|
||||||
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]",
|
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %zu) for chunk [%d, %d]",
|
||||||
UncompressedSize, UncompressedData.size(),
|
UncompressedSize, UncompressedData.size(),
|
||||||
Header->m_ChunkX, Header->m_ChunkZ
|
Header->m_ChunkX, Header->m_ChunkZ
|
||||||
);
|
);
|
||||||
@ -866,7 +866,7 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_Uncomp
|
|||||||
|
|
||||||
if (a_UncompressedSize != (int)UncompressedData.size())
|
if (a_UncompressedSize != (int)UncompressedData.size())
|
||||||
{
|
{
|
||||||
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]",
|
LOGWARNING("Uncompressed data size differs (exp %d bytes, got %zu) for chunk [%d, %d]",
|
||||||
a_UncompressedSize, UncompressedData.size(),
|
a_UncompressedSize, UncompressedData.size(),
|
||||||
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
|
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user