fix another udp bit issue

This commit is contained in:
DarthArgus
2014-10-27 15:26:05 -07:00
parent 56f8a68f01
commit 62ee2c2210
2 changed files with 4 additions and 5 deletions
@@ -2677,8 +2677,7 @@ void UdpConnection::FlushMultiBuffer()
int UdpConnection::EncryptNone(uchar *destData, const uchar *sourceData, int sourceLen)
{
memcpy(destData, sourceData, sourceLen);
return(sourceLen);
return(DecryptNone(destData, sourceData, sourceLen));
}
int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sourceLen)
@@ -4153,7 +4152,7 @@ int UdpMisc::Random(int *seed)
return(*seed);
}
long UdpMisc::Crc32(const void *buffer, int bufferLen, int encryptValue)
unsigned long int UdpMisc::Crc32(const void *buffer, int bufferLen, int encryptValue)
{
static unsigned crc32_table[256] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
@@ -4200,7 +4199,7 @@ long UdpMisc::Crc32(const void *buffer, int bufferLen, int encryptValue)
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D};
long crc = 0xffffffff;
unsigned long int crc = 0xffffffff;
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ (encryptValue & 0xff)) & 0x000000FFL];
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 8) & 0xff)) & 0x000000FFL];
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 16) & 0xff)) & 0x000000FFL];
@@ -126,7 +126,7 @@ class UdpMisc
static int ClockElapsed(ClockStamp stamp); // returns a elapsed time since stamp in milliseconds (if elapsed is over 23 days, it returns 23 days)
static int ClockDiff(ClockStamp start, ClockStamp stop); // returns a time difference in milliseconds (if difference is over 23 days, it returns 23 days)
static long Crc32(const void *buffer, int bufferLen, int encryptValue = 0); // calculate a 32-bit crc for a buffer (encrypt value simple scrambles the crc at the beginning so the same packet doesn't produce the same crc on different connections)
static unsigned long int Crc32(const void *buffer, int bufferLen, int encryptValue = 0); // calculate a 32-bit crc for a buffer (encrypt value simple scrambles the crc at the beginning so the same packet doesn't produce the same crc on different connections)
static int Random(int *seed); // random number generator
static void Sleep(int milliseconds);