summaryrefslogtreecommitdiffstats
path: root/Tools/ProtoProxy
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-10 20:21:18 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-10 20:21:18 +0100
commitbc556e7f00ee28198b5ba3e46c1c06caab8fc37b (patch)
tree01592f68380754db412e070f14d9069507fc107f /Tools/ProtoProxy
parentMerge branch 'master' into Werror (diff)
downloadcuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar.gz
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar.bz2
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar.lz
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar.xz
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.tar.zst
cuberite-bc556e7f00ee28198b5ba3e46c1c06caab8fc37b.zip
Diffstat (limited to 'Tools/ProtoProxy')
-rw-r--r--Tools/ProtoProxy/Connection.cpp16
-rw-r--r--Tools/ProtoProxy/Connection.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 91d2fc42f..be908f303 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -131,8 +131,6 @@
} \
}
-
-#define MAX_ENC_LEN 1024
@@ -473,14 +471,14 @@ bool cConnection::SendData(SOCKET a_Socket, cByteBuffer & a_Data, const char * a
-bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, int a_Size, const char * a_Peer)
+bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer)
{
DataLog(a_Data, a_Size, "Encrypting %d bytes to %s", a_Size, a_Peer);
const Byte * Data = (const Byte *)a_Data;
while (a_Size > 0)
{
Byte Buffer[64 KiB];
- int NumBytes = (a_Size > sizeof(Buffer)) ? sizeof(Buffer) : a_Size;
+ size_t NumBytes = (a_Size > sizeof(Buffer)) ? sizeof(Buffer) : a_Size;
a_Encryptor.ProcessData(Buffer, Data, NumBytes);
bool res = SendData(a_Socket, (const char *)Buffer, NumBytes, a_Peer);
if (!res)
@@ -2263,7 +2261,9 @@ bool cConnection::HandleServerSpawnObjectVehicle(void)
HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Yaw);
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, DataIndicator);
AString ExtraData;
- short VelocityX, VelocityY, VelocityZ;
+ short VelocityX = 0;
+ short VelocityY = 0;
+ short VelocityZ = 0;
if (DataIndicator != 0)
{
HANDLE_SERVER_PACKET_READ(ReadBEShort, short, SpeedX);
@@ -2697,7 +2697,7 @@ bool cConnection::ParseMetadata(cByteBuffer & a_Buffer, AString & a_Metadata)
a_Metadata.push_back(x);
while (x != 0x7f)
{
- int Index = ((unsigned)((unsigned char)x)) & 0x1f; // Lower 5 bits = index
+ //int Index = ((unsigned)((unsigned char)x)) & 0x1f; // Lower 5 bits = index
int Type = ((unsigned)((unsigned char)x)) >> 5; // Upper 3 bits = type
int Length = 0;
switch (Type)
@@ -2772,7 +2772,7 @@ void cConnection::LogMetadata(const AString & a_Metadata, size_t a_IndentCount)
{
int Index = ((unsigned)((unsigned char)a_Metadata[pos])) & 0x1f; // Lower 5 bits = index
int Type = ((unsigned)((unsigned char)a_Metadata[pos])) >> 5; // Upper 3 bits = type
- int Length = 0;
+ //int Length = 0;
switch (Type)
{
case 0:
@@ -2827,7 +2827,7 @@ void cConnection::LogMetadata(const AString & a_Metadata, size_t a_IndentCount)
ASSERT(!"Cannot parse item description from metadata");
return;
}
- int After = bb.GetReadableSpace();
+ //int After = bb.GetReadableSpace();
int BytesConsumed = BytesLeft - bb.GetReadableSpace();
Log("%sslot[%d] = %s (%d bytes)", Indent.c_str(), Index, ItemDesc.c_str(), BytesConsumed);
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index 5e4f8cd7b..70b759d0f 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -109,7 +109,7 @@ protected:
bool SendData(SOCKET a_Socket, cByteBuffer & a_Data, const char * a_Peer);
/// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false
- bool SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, int a_Size, const char * a_Peer);
+ bool SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer);
/// Sends data to the specfied socket, after encrypting it using a_Encryptor. If sending fails, prints a fail message using a_Peer and returns false
bool SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, cByteBuffer & a_Data, const char * a_Peer);