mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Remove trailing whitespace
This commit is contained in:
+38
-38
@@ -38,11 +38,11 @@ void EncryptProfilePacket(uchar* pBuffer, uint32 size) {
|
||||
uint64 crypt = 0x659365E7;
|
||||
uint64 next_crypt;
|
||||
uint32 len = size >> 3;
|
||||
|
||||
|
||||
uint64 swap = data[0];
|
||||
data[0] = data[len/2];
|
||||
data[len/2] = swap;
|
||||
|
||||
|
||||
for(uint32 i=0; i<len;i++) {
|
||||
next_crypt = crypt+data[i]-0x422437A9;
|
||||
data[i] = ((data[i]>>0x19)|(data[i]<<0x27))+0x422437A9;
|
||||
@@ -61,11 +61,11 @@ void EncryptZoneSpawnPacket(uchar* pBuffer, uint32 size) {
|
||||
uint64 crypt = 0x0000;
|
||||
uint64 next_crypt;
|
||||
uint32 len = size >> 3;
|
||||
|
||||
|
||||
uint64 swap = data[0];
|
||||
data[0] = data[len/2];
|
||||
data[len/2] = swap;
|
||||
|
||||
|
||||
for(uint32 i=0; i<len;i++) {
|
||||
next_crypt = crypt+data[i]-0x659365E7;
|
||||
data[i] = ((data[i]<<0x1d)|(data[i]>>0x23))+0x659365E7;
|
||||
@@ -101,7 +101,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou
|
||||
static bool inited = false;
|
||||
static z_stream zstream;
|
||||
int zerror;
|
||||
|
||||
|
||||
if(in_data == nullptr && out_data == nullptr && in_length == 0 && max_out_length == 0) {
|
||||
//special delete state
|
||||
deflateEnd(&zstream);
|
||||
@@ -114,7 +114,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou
|
||||
zstream.opaque = Z_NULL;
|
||||
deflateInit(&zstream, Z_FINISH);
|
||||
}
|
||||
|
||||
|
||||
zstream.next_in = const_cast<unsigned char *>(in_data);
|
||||
zstream.avail_in = in_length;
|
||||
/* zstream.zalloc = Z_NULL;
|
||||
@@ -124,9 +124,9 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou
|
||||
zstream.next_out = out_data;
|
||||
zstream.avail_out = max_out_length;
|
||||
zerror = deflate(&zstream, Z_FINISH);
|
||||
|
||||
|
||||
deflateReset(&zstream);
|
||||
|
||||
|
||||
if (zerror == Z_STREAM_END)
|
||||
{
|
||||
// deflateEnd(&zstream);
|
||||
@@ -141,11 +141,11 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou
|
||||
if(in_data == nullptr) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
z_stream zstream;
|
||||
memset(&zstream, 0, sizeof(zstream));
|
||||
int zerror;
|
||||
|
||||
|
||||
zstream.next_in = const_cast<unsigned char *>(in_data);
|
||||
zstream.avail_in = in_length;
|
||||
zstream.zalloc = eqemu_alloc_func;
|
||||
@@ -155,7 +155,7 @@ int DeflatePacket(const unsigned char* in_data, int in_length, unsigned char* ou
|
||||
zstream.next_out = out_data;
|
||||
zstream.avail_out = max_out_length;
|
||||
zerror = deflate(&zstream, Z_FINISH);
|
||||
|
||||
|
||||
if (zerror == Z_STREAM_END)
|
||||
{
|
||||
deflateEnd(&zstream);
|
||||
@@ -174,7 +174,7 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint
|
||||
static bool inited = false;
|
||||
static z_stream zstream;
|
||||
int zerror;
|
||||
|
||||
|
||||
if(indata == nullptr && outdata == nullptr && indatalen == 0 && outdatalen == 0) {
|
||||
//special delete state
|
||||
inflateEnd(&zstream);
|
||||
@@ -194,16 +194,16 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint
|
||||
zstream.zalloc = eqemu_alloc_func;
|
||||
zstream.zfree = eqemu_free_func;
|
||||
zstream.opaque = Z_NULL;
|
||||
|
||||
i = inflateInit2( &zstream, 15 );
|
||||
if (i != Z_OK) {
|
||||
|
||||
i = inflateInit2( &zstream, 15 );
|
||||
if (i != Z_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
zerror = inflate( &zstream, Z_FINISH );
|
||||
|
||||
|
||||
inflateReset(&zstream);
|
||||
|
||||
|
||||
if(zerror == Z_STREAM_END) {
|
||||
return zstream.total_out;
|
||||
}
|
||||
@@ -217,22 +217,22 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint
|
||||
DumpPacket(indata-16, indatalen+16);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (zerror == -4 && zstream.msg == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if(indata == nullptr)
|
||||
return(0);
|
||||
|
||||
|
||||
z_stream zstream;
|
||||
int zerror = 0;
|
||||
int i;
|
||||
|
||||
|
||||
zstream.next_in = const_cast<unsigned char *>(indata);
|
||||
zstream.avail_in = indatalen;
|
||||
zstream.next_out = outdata;
|
||||
@@ -240,14 +240,14 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint
|
||||
zstream.zalloc = eqemu_alloc_func;
|
||||
zstream.zfree = eqemu_free_func;
|
||||
zstream.opaque = Z_NULL;
|
||||
|
||||
i = inflateInit2( &zstream, 15 );
|
||||
if (i != Z_OK) {
|
||||
|
||||
i = inflateInit2( &zstream, 15 );
|
||||
if (i != Z_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
zerror = inflate( &zstream, Z_FINISH );
|
||||
|
||||
|
||||
if(zerror == Z_STREAM_END) {
|
||||
inflateEnd( &zstream );
|
||||
return zstream.total_out;
|
||||
@@ -262,12 +262,12 @@ uint32 InflatePacket(const uchar* indata, uint32 indatalen, uchar* outdata, uint
|
||||
DumpPacket(indata-16, indatalen+16);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (zerror == -4 && zstream.msg == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
zerror = inflateEnd( &zstream );
|
||||
return 0;
|
||||
}
|
||||
@@ -293,30 +293,30 @@ uint64 rorl(uint64 in, uint8 bits) {
|
||||
uint32 CRCLookup(uchar idx) {
|
||||
if (idx == 0)
|
||||
return 0x00000000;
|
||||
|
||||
|
||||
if (idx == 1)
|
||||
return 0x77073096;
|
||||
|
||||
|
||||
if (idx == 2)
|
||||
return roll(CRCLookup(1), 1);
|
||||
|
||||
|
||||
if (idx == 4)
|
||||
return 0x076DC419;
|
||||
|
||||
|
||||
for (uchar b=7; b>0; b--) {
|
||||
uchar bv = 1 << b;
|
||||
|
||||
|
||||
if (!(idx ^ bv)) {
|
||||
// bit is only one set
|
||||
return ( roll(CRCLookup (4), b - 2) );
|
||||
}
|
||||
|
||||
|
||||
if (idx&bv) {
|
||||
// bit is set
|
||||
return( CRCLookup(bv) ^ CRCLookup(idx&(bv - 1)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Failure
|
||||
return false;
|
||||
}
|
||||
@@ -325,10 +325,10 @@ uint32 GenerateCRC(uint32 b, uint32 bufsize, uchar *buf) {
|
||||
uint32 CRC = (b ^ 0xFFFFFFFF);
|
||||
uint32 bufremain = bufsize;
|
||||
uchar* bufptr = buf;
|
||||
|
||||
|
||||
while (bufremain--) {
|
||||
CRC = CRCLookup((uchar)(*(bufptr++)^ (CRC&0xFF))) ^ (CRC >> 8);
|
||||
}
|
||||
|
||||
|
||||
return (htonl (CRC ^ 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user