Fixed warnings generated by 64-bit MSVC.
This commit is contained in:
parent
5953e0f1c6
commit
bebd4de144
@ -440,9 +440,9 @@ bool cClientHandle::StreamNextChunk(void)
|
||||
int RangeX, RangeZ = 0;
|
||||
cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ);
|
||||
|
||||
for (size_t X = 0; X < 7; X++)
|
||||
for (int X = 0; X < 7; X++)
|
||||
{
|
||||
for (size_t Z = 0; Z < 7; Z++)
|
||||
for (int Z = 0; Z < 7; Z++)
|
||||
{
|
||||
int ChunkX = RangeX + ((X >= 4) ? (3 - X) : X);
|
||||
int ChunkZ = RangeZ + ((Z >= 4) ? (3 - Z) : Z);
|
||||
|
@ -86,8 +86,8 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
|
||||
{
|
||||
if (((m_NumHits + m_NumMisses) % 1024) == 10)
|
||||
{
|
||||
LOGD("BioGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
|
||||
LOGD("BioGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits);
|
||||
LOGD("BioGenCache: %u hits, %u misses, saved %.2f %%", static_cast<unsigned>(m_NumHits), static_cast<unsigned>(m_NumMisses), 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
|
||||
LOGD("BioGenCache: Avg cache chain length: %.2f", static_cast<double>(m_TotalChain) / m_NumHits);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_CacheSize; i++)
|
||||
|
@ -68,9 +68,9 @@ protected:
|
||||
sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
|
||||
|
||||
// Cache statistics
|
||||
int m_NumHits;
|
||||
int m_NumMisses;
|
||||
int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
|
||||
size_t m_NumHits;
|
||||
size_t m_NumMisses;
|
||||
size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
|
||||
|
||||
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
|
||||
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
|
||||
|
@ -73,7 +73,7 @@ SET (HDRS
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum")
|
||||
set_source_files_properties(Caves.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(ChunkGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(CompoGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
|
@ -102,16 +102,16 @@ void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cHeiGenCache:
|
||||
|
||||
cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize) :
|
||||
cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize) :
|
||||
m_HeiGenToCache(a_HeiGenToCache),
|
||||
m_CacheSize(a_CacheSize),
|
||||
m_CacheOrder(new int[a_CacheSize]),
|
||||
m_CacheOrder(new size_t[a_CacheSize]),
|
||||
m_CacheData(new sCacheData[a_CacheSize]),
|
||||
m_NumHits(0),
|
||||
m_NumMisses(0),
|
||||
m_TotalChain(0)
|
||||
{
|
||||
for (int i = 0; i < m_CacheSize; i++)
|
||||
for (size_t i = 0; i < m_CacheSize; i++)
|
||||
{
|
||||
m_CacheOrder[i] = i;
|
||||
m_CacheData[i].m_ChunkX = 0x7fffffff;
|
||||
@ -141,11 +141,11 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
|
||||
if (((m_NumHits + m_NumMisses) % 1024) == 10)
|
||||
{
|
||||
LOGD("HeiGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
|
||||
LOGD("HeiGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits);
|
||||
LOGD("HeiGenCache: Avg cache chain length: %.2f", static_cast<double>(m_TotalChain) / m_NumHits);
|
||||
}
|
||||
//*/
|
||||
|
||||
for (int i = 0; i < m_CacheSize; i++)
|
||||
for (size_t i = 0; i < m_CacheSize; i++)
|
||||
{
|
||||
if (
|
||||
(m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) ||
|
||||
@ -155,10 +155,10 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
|
||||
continue;
|
||||
}
|
||||
// Found it in the cache
|
||||
int Idx = m_CacheOrder[i];
|
||||
auto Idx = m_CacheOrder[i];
|
||||
|
||||
// Move to front:
|
||||
for (int j = i; j > 0; j--)
|
||||
for (size_t j = i; j > 0; j--)
|
||||
{
|
||||
m_CacheOrder[j] = m_CacheOrder[j - 1];
|
||||
}
|
||||
@ -177,8 +177,8 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
|
||||
m_HeiGenToCache->GenHeightMap(a_ChunkX, a_ChunkZ, a_HeightMap);
|
||||
|
||||
// Insert it as the first item in the MRU order:
|
||||
int Idx = m_CacheOrder[m_CacheSize - 1];
|
||||
for (int i = m_CacheSize - 1; i > 0; i--)
|
||||
auto Idx = m_CacheOrder[m_CacheSize - 1];
|
||||
for (auto i = m_CacheSize - 1; i > 0; i--)
|
||||
{
|
||||
m_CacheOrder[i] = m_CacheOrder[i - 1];
|
||||
} // for i - m_CacheOrder[]
|
||||
@ -194,7 +194,7 @@ void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
|
||||
|
||||
bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height)
|
||||
{
|
||||
for (int i = 0; i < m_CacheSize; i++)
|
||||
for (size_t i = 0; i < m_CacheSize; i++)
|
||||
{
|
||||
if ((m_CacheData[i].m_ChunkX == a_ChunkX) && (m_CacheData[i].m_ChunkZ == a_ChunkZ))
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ class cHeiGenCache :
|
||||
public cTerrainHeightGen
|
||||
{
|
||||
public:
|
||||
cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize);
|
||||
cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize);
|
||||
~cHeiGenCache();
|
||||
|
||||
// cTerrainHeightGen overrides:
|
||||
@ -49,14 +49,14 @@ protected:
|
||||
cTerrainHeightGenPtr m_HeiGenToCache;
|
||||
|
||||
// To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data
|
||||
int m_CacheSize;
|
||||
int * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
|
||||
size_t m_CacheSize;
|
||||
size_t * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
|
||||
sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
|
||||
|
||||
// Cache statistics
|
||||
int m_NumHits;
|
||||
int m_NumMisses;
|
||||
int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
|
||||
size_t m_NumHits;
|
||||
size_t m_NumMisses;
|
||||
size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set_source_files_properties(ChunkDataSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(MojangAPI.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Packetizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch -Wno-error=old-style-cast")
|
||||
set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch")
|
||||
set_source_files_properties(Protocol17x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast")
|
||||
set_source_files_properties(ProtocolRecognizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast")
|
||||
endif()
|
||||
|
@ -747,7 +747,7 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor
|
||||
cPacketizer Pkt(*this, 0x34);
|
||||
Pkt.WriteVarInt32(a_ID);
|
||||
Pkt.WriteBEUInt8(m_Scale);
|
||||
Pkt.WriteVarInt32(a_Decorators.size());
|
||||
Pkt.WriteVarInt32(static_cast<UInt32>(a_Decorators.size()));
|
||||
|
||||
for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it)
|
||||
{
|
||||
@ -1715,7 +1715,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
|
||||
// Compress the data:
|
||||
char CompressedData[MAX_COMPRESSED_PACKET_LEN];
|
||||
|
||||
uLongf CompressedSize = compressBound(a_Packet.size());
|
||||
uLongf CompressedSize = compressBound(static_cast<uLongf>(a_Packet.size()));
|
||||
if (CompressedSize >= MAX_COMPRESSED_PACKET_LEN)
|
||||
{
|
||||
ASSERT(!"Too high packet size.");
|
||||
@ -1724,7 +1724,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
|
||||
|
||||
int Status = compress2(
|
||||
reinterpret_cast<Bytef *>(CompressedData), &CompressedSize,
|
||||
reinterpret_cast<const Bytef *>(a_Packet.data()), a_Packet.size(), Z_DEFAULT_COMPRESSION
|
||||
reinterpret_cast<const Bytef *>(a_Packet.data()), static_cast<uLongf>(a_Packet.size()), Z_DEFAULT_COMPRESSION
|
||||
);
|
||||
if (Status != Z_OK)
|
||||
{
|
||||
@ -1737,7 +1737,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress
|
||||
Buffer.ReadAll(LengthData);
|
||||
Buffer.CommitRead();
|
||||
|
||||
Buffer.WriteVarInt32(CompressedSize + LengthData.size());
|
||||
Buffer.WriteVarInt32(static_cast<UInt32>(CompressedSize + LengthData.size()));
|
||||
Buffer.WriteVarInt32(static_cast<UInt32>(a_Packet.size()));
|
||||
Buffer.ReadAll(LengthData);
|
||||
Buffer.CommitRead();
|
||||
@ -1910,7 +1910,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
|
||||
AString UncompressedData;
|
||||
if (m_State == 3)
|
||||
{
|
||||
UInt32 NumBytesRead = m_ReceivedData.GetReadableSpace();
|
||||
UInt32 NumBytesRead = static_cast<UInt32>(m_ReceivedData.GetReadableSpace());
|
||||
m_ReceivedData.ReadVarInt(CompressedSize);
|
||||
if (CompressedSize > PacketLen)
|
||||
{
|
||||
@ -1926,11 +1926,11 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
|
||||
m_Client->Kick("Compression failure");
|
||||
return;
|
||||
}
|
||||
PacketLen = UncompressedData.size();
|
||||
PacketLen = static_cast<UInt32>(UncompressedData.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
NumBytesRead -= m_ReceivedData.GetReadableSpace(); // How many bytes has the CompressedSize taken up?
|
||||
NumBytesRead -= static_cast<UInt32>(m_ReceivedData.GetReadableSpace()); // How many bytes has the CompressedSize taken up?
|
||||
ASSERT(PacketLen > NumBytesRead);
|
||||
PacketLen -= NumBytesRead;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user