From e175ae551c5e1e8034648f950c016b6348d6bf09 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:41:18 +0200 Subject: Fixed warning in cBlockArea. --- src/BlockArea.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/BlockArea.h b/src/BlockArea.h index 4c4dfb8ff..6dba0f12e 100644 --- a/src/BlockArea.h +++ b/src/BlockArea.h @@ -294,7 +294,7 @@ public: NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block! NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block! NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block! - size_t GetBlockCount(void) const { return m_Size.x * m_Size.y * m_Size.z; } + size_t GetBlockCount(void) const { return (size_t)(m_Size.x * m_Size.y * m_Size.z); } int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const; protected: -- cgit v1.2.3 From a6eba4ff8b007863eac20693db5dd859f0dcbc70 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:41:41 +0200 Subject: Fixed warning in cCallbackSslContext::cDataCallbacks. --- src/PolarSSL++/CallbackSslContext.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/PolarSSL++/CallbackSslContext.h b/src/PolarSSL++/CallbackSslContext.h index 4e4c1ed7f..3e6edc5f4 100644 --- a/src/PolarSSL++/CallbackSslContext.h +++ b/src/PolarSSL++/CallbackSslContext.h @@ -23,6 +23,9 @@ public: class cDataCallbacks { public: + // Force a virtual destructor in descendants: + virtual ~cDataCallbacks() {} + /** Called when PolarSSL wants to read encrypted data from the SSL peer. The returned value is the number of bytes received, or a PolarSSL error on failure. The implementation can return POLARSSL_ERR_NET_WANT_READ or POLARSSL_ERR_NET_WANT_WRITE to indicate -- cgit v1.2.3 From b6b86b7270ca3f44b0b2a24ffe8292e87e762713 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:43:37 +0200 Subject: Fixed warnings in FastNBT. --- src/WorldStorage/FastNBT.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 5e5af3ca3..bcf93228f 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -237,7 +237,7 @@ public: { ASSERT(m_Tags[(size_t)a_Tag].m_Type == TAG_String); AString res; - res.assign(m_Data + m_Tags[(size_t)a_Tag].m_DataStart, m_Tags[(size_t)a_Tag].m_DataLength); + res.assign(m_Data + m_Tags[(size_t)a_Tag].m_DataStart, (size_t)m_Tags[(size_t)a_Tag].m_DataLength); return res; } @@ -245,7 +245,7 @@ public: inline AString GetName(int a_Tag) const { AString res; - res.assign(m_Data + m_Tags[(size_t)a_Tag].m_NameStart, m_Tags[(size_t)a_Tag].m_NameLength); + res.assign(m_Data + m_Tags[(size_t)a_Tag].m_NameStart, (size_t)m_Tags[(size_t)a_Tag].m_NameLength); return res; } -- cgit v1.2.3 From a91129af4ac186eaceb5fbf044539c052c4c6cf8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:44:52 +0200 Subject: Fixed warnings in cBlockArea. --- src/BlockArea.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp index 55e8d6849..e0ae2c5b6 100644 --- a/src/BlockArea.cpp +++ b/src/BlockArea.cpp @@ -2005,7 +2005,7 @@ void cBlockArea::ExpandBlockTypes(int a_SubMinX, int a_AddMaxX, int a_SubMinY, i int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX; int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY; int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ; - size_t BlockCount = (size_t)NewSizeX * NewSizeY * NewSizeZ; + size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ); BLOCKTYPE * NewBlockTypes = new BLOCKTYPE[BlockCount]; memset(NewBlockTypes, 0, BlockCount * sizeof(BLOCKTYPE)); int OldIndex = 0; @@ -2035,7 +2035,7 @@ void cBlockArea::ExpandNibbles(NIBBLEARRAY & a_Array, int a_SubMinX, int a_AddMa int NewSizeX = m_Size.x + a_SubMinX + a_AddMaxX; int NewSizeY = m_Size.y + a_SubMinY + a_AddMaxY; int NewSizeZ = m_Size.z + a_SubMinZ + a_AddMaxZ; - size_t BlockCount = (size_t)NewSizeX * NewSizeY * NewSizeZ; + size_t BlockCount = (size_t)(NewSizeX * NewSizeY * NewSizeZ); NIBBLETYPE * NewNibbles = new NIBBLETYPE[BlockCount]; memset(NewNibbles, 0, BlockCount * sizeof(NIBBLETYPE)); int OldIndex = 0; -- cgit v1.2.3 From a4d8c6d656da6b3b4c986361213bb65540a08e80 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:47:02 +0200 Subject: Fixed warning in BlockID. --- src/BlockID.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/BlockID.cpp b/src/BlockID.cpp index bf95d0798..bfe826f40 100644 --- a/src/BlockID.cpp +++ b/src/BlockID.cpp @@ -102,7 +102,7 @@ public: return true; } - a_Item.m_ItemDamage = atoi(Split[1].c_str()); + a_Item.m_ItemDamage = (short)atoi(Split[1].c_str()); if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0")) { // Parsing the number failed -- cgit v1.2.3 From fb173a756ca7c0cd9ebfde70e5a5af0a78faa884 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:54:22 +0200 Subject: Fixed warnings in cByteBuffer. --- src/ByteBuffer.cpp | 26 +++++++++++++------------- src/ByteBuffer.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index c27bc4cad..4de89f7c1 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -327,7 +327,7 @@ bool cByteBuffer::ReadBEShort(short & a_Value) CheckValid(); NEEDBYTES(2); ReadBuf(&a_Value, 2); - a_Value = ntohs(a_Value); + a_Value = (short)ntohs((u_short)a_Value); return true; } @@ -341,7 +341,7 @@ bool cByteBuffer::ReadBEInt(int & a_Value) CheckValid(); NEEDBYTES(4); ReadBuf(&a_Value, 4); - a_Value = ntohl(a_Value); + a_Value = (int)ntohl((u_long)a_Value); return true; } @@ -420,7 +420,7 @@ bool cByteBuffer::ReadBEUTF16String16(AString & a_Value) ASSERT(!"Negative string length? Are you sure?"); return true; } - return ReadUTF16String(a_Value, Length); + return ReadUTF16String(a_Value, (size_t)Length); } @@ -438,7 +438,7 @@ bool cByteBuffer::ReadVarInt(UInt32 & a_Value) { NEEDBYTES(1); ReadBuf(&b, 1); - Value = Value | (((Int64)(b & 0x7f)) << Shift); + Value = Value | (((UInt32)(b & 0x7f)) << Shift); Shift += 7; } while ((b & 0x80) != 0); a_Value = Value; @@ -462,7 +462,7 @@ bool cByteBuffer::ReadVarUTF8String(AString & a_Value) { LOGWARNING("%s: String too large: %u (%u KiB)", __FUNCTION__, Size, Size / 1024); } - return ReadString(a_Value, (int)Size); + return ReadString(a_Value, (size_t)Size); } @@ -517,7 +517,7 @@ bool cByteBuffer::WriteBEShort(short a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(2); - short Converted = htons(a_Value); + u_short Converted = htons((u_short)a_Value); return WriteBuf(&Converted, 2); } @@ -530,7 +530,7 @@ bool cByteBuffer::WriteBEInt(int a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(4); - int Converted = HostToNetwork4(&a_Value); + UInt32 Converted = HostToNetwork4(&a_Value); return WriteBuf(&Converted, 4); } @@ -543,7 +543,7 @@ bool cByteBuffer::WriteBEInt64(Int64 a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(8); - Int64 Converted = HostToNetwork8(&a_Value); + UInt64 Converted = HostToNetwork8(&a_Value); return WriteBuf(&Converted, 8); } @@ -556,7 +556,7 @@ bool cByteBuffer::WriteBEFloat(float a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(4); - int Converted = HostToNetwork4(&a_Value); + UInt32 Converted = HostToNetwork4(&a_Value); return WriteBuf(&Converted, 4); } @@ -569,7 +569,7 @@ bool cByteBuffer::WriteBEDouble(double a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(8); - Int64 Converted = HostToNetwork8(&a_Value); + UInt64 Converted = HostToNetwork8(&a_Value); return WriteBuf(&Converted, 8); } @@ -613,7 +613,7 @@ bool cByteBuffer::WriteVarInt(UInt32 a_Value) // A 32-bit integer can be encoded by at most 5 bytes: unsigned char b[5]; - int idx = 0; + size_t idx = 0; do { b[idx] = (a_Value & 0x7f) | ((a_Value > 0x7f) ? 0x80 : 0x00); @@ -632,7 +632,7 @@ bool cByteBuffer::WriteVarUTF8String(const AString & a_Value) CHECK_THREAD; CheckValid(); PUTBYTES(a_Value.size() + 1); // This is a lower-bound on the bytes that will be actually written. Fail early. - bool res = WriteVarInt(a_Value.size()); + bool res = WriteVarInt((UInt32)(a_Value.size())); if (!res) { return false; @@ -757,7 +757,7 @@ bool cByteBuffer::ReadString(AString & a_String, size_t a_Count) -bool cByteBuffer::ReadUTF16String(AString & a_String, int a_NumChars) +bool cByteBuffer::ReadUTF16String(AString & a_String, size_t a_NumChars) { // Reads 2 * a_NumChars bytes and interprets it as a UTF16 string, converting it into UTF8 string a_String CHECK_THREAD; diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h index 7656a5b13..929c93167 100644 --- a/src/ByteBuffer.h +++ b/src/ByteBuffer.h @@ -101,7 +101,7 @@ public: bool ReadString(AString & a_String, size_t a_Count); /// Reads 2 * a_NumChars bytes and interprets it as a UTF16-BE string, converting it into UTF8 string a_String - bool ReadUTF16String(AString & a_String, int a_NumChars); + bool ReadUTF16String(AString & a_String, size_t a_NumChars); /// Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer bool SkipRead(size_t a_Count); -- cgit v1.2.3 From ed75d3a8364f360b213956c40c51729ea53f3616 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:58:58 +0200 Subject: Fixed warnings in ClientHandle. --- src/ClientHandle.cpp | 4 ++-- src/Protocol/Protocol.h | 2 +- src/Protocol/Protocol125.cpp | 2 +- src/Protocol/Protocol125.h | 2 +- src/Protocol/Protocol17x.cpp | 2 +- src/Protocol/Protocol17x.h | 2 +- src/Protocol/ProtocolRecognizer.cpp | 2 +- src/Protocol/ProtocolRecognizer.h | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 2362abe1e..7a4158491 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -1658,7 +1658,7 @@ void cClientHandle::SendData(const char * a_Data, size_t a_Size) { // There is a queued overflow. Append to it, then send as much from its front as possible m_OutgoingDataOverflow.append(a_Data, a_Size); - int CanFit = m_OutgoingData.GetFreeSpace(); + size_t CanFit = m_OutgoingData.GetFreeSpace(); if (CanFit > 128) { // No point in moving the data over if it's not large enough - too much effort for too little an effect @@ -2522,7 +2522,7 @@ void cClientHandle::SendWindowOpen(const cWindow & a_Window) -void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) +void cClientHandle::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) { m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); } diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index 2fbeef0fa..8f152ad37 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -123,7 +123,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) = 0; virtual void SendWindowClose (const cWindow & a_Window) = 0; virtual void SendWindowOpen (const cWindow & a_Window) = 0; - virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) = 0; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) = 0; /// Returns the ServerID used for authentication through session.minecraft.net virtual AString GetAuthServerID(void) = 0; diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index 35ab72bfc..e7873cf7a 100644 --- a/src/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp @@ -1175,7 +1175,7 @@ void cProtocol125::SendWindowOpen(const cWindow & a_Window) -void cProtocol125::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cProtocol125::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) { cCSLock Lock(m_CSPacket); WriteByte (PACKET_WINDOW_PROPERTY); diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 89e64f386..423e58d67 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -96,7 +96,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; virtual AString GetAuthServerID(void) override; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index a6d566625..bc9aff0c0 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -1383,7 +1383,7 @@ void cProtocol172::SendWindowOpen(const cWindow & a_Window) -void cProtocol172::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cProtocol172::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) { ASSERT(m_State == 3); // In game mode? diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h index 3f9c93357..eed761a4a 100644 --- a/src/Protocol/Protocol17x.h +++ b/src/Protocol/Protocol17x.h @@ -128,7 +128,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; virtual AString GetAuthServerID(void) override { return m_AuthServerID; } diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 2ccb9f197..22dfe7c88 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -357,7 +357,7 @@ void cProtocolRecognizer::SendHealth(void) -void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cProtocolRecognizer::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) { ASSERT(m_Protocol != NULL); m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 408109ef4..37f47379d 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -131,7 +131,7 @@ public: virtual void SendWholeInventory (const cWindow & a_Window) override; virtual void SendWindowClose (const cWindow & a_Window) override; virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; + virtual void SendWindowProperty (const cWindow & a_Window, int a_Property, int a_Value) override; virtual AString GetAuthServerID(void) override; -- cgit v1.2.3 From e24bdc9328278b676c7acf83fd9f31b430561b98 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 23:03:23 +0200 Subject: More ClientHandle fixes. --- src/ClientHandle.cpp | 4 ++-- src/ClientHandle.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 7a4158491..4ed0d682f 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -716,7 +716,7 @@ void cClientHandle::UnregisterPluginChannels(const AStringVector & a_ChannelList -void cClientHandle::HandleCommandBlockMessage(const char * a_Data, unsigned int a_Length) +void cClientHandle::HandleCommandBlockMessage(const char * a_Data, size_t a_Length) { if (a_Length < 14) { @@ -2522,7 +2522,7 @@ void cClientHandle::SendWindowOpen(const cWindow & a_Window) -void cClientHandle::SendWindowProperty(const cWindow & a_Window, short a_Property, short a_Value) +void cClientHandle::SendWindowProperty(const cWindow & a_Window, int a_Property, int a_Value) { m_Protocol->SendWindowProperty(a_Window, a_Property, a_Value); } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 9f8d44129..9fd17ac00 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -384,7 +384,7 @@ private: void UnregisterPluginChannels(const AStringVector & a_ChannelList); /** Handles the "MC|AdvCdm" plugin message */ - void HandleCommandBlockMessage(const char * a_Data, unsigned int a_Length); + void HandleCommandBlockMessage(const char * a_Data, size_t a_Length); // cSocketThreads::cCallback overrides: virtual void DataReceived (const char * a_Data, size_t a_Size) override; // Data is received from the client -- cgit v1.2.3 From cb07541029bbce8a2bd46a58850af20687588978 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 23:10:37 +0200 Subject: Fixed a warning in Noise. --- src/Noise.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Noise.h b/src/Noise.h index 62004503f..e605051b5 100644 --- a/src/Noise.h +++ b/src/Noise.h @@ -280,7 +280,7 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct) { const NOISE_DATATYPE ft = a_Pct * (NOISE_DATATYPE)3.1415927; - const NOISE_DATATYPE f = (1 - cos(ft)) * (NOISE_DATATYPE)0.5; + const NOISE_DATATYPE f = (NOISE_DATATYPE)((NOISE_DATATYPE)(1 - cos(ft)) * (NOISE_DATATYPE)0.5); return a_A * (1 - f) + a_B * f; } -- cgit v1.2.3