summaryrefslogtreecommitdiff
path: root/src/common/grfio.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-04 15:40:59 -0300
committershennetsind <ind@henn.et>2013-05-04 15:40:59 -0300
commitc5986ba47dbd5034018ab288c39feee7ff5d7d1f (patch)
treeea8d5e6f03f4993e1bf94b4d334a5dd2546c5950 /src/common/grfio.c
parent6731a64f92ccecd09803ec07afa8bc817ab8d17d (diff)
downloadhercules-c5986ba47dbd5034018ab288c39feee7ff5d7d1f.tar.gz
hercules-c5986ba47dbd5034018ab288c39feee7ff5d7d1f.tar.bz2
hercules-c5986ba47dbd5034018ab288c39feee7ff5d7d1f.tar.xz
hercules-c5986ba47dbd5034018ab288c39feee7ff5d7d1f.zip
Upgrading Stat Server from 2.5 to 3.0
also: modified encode_zip in grfio for a upcoming modification and some minor stuff in some other places. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/grfio.c')
-rw-r--r--src/common/grfio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index cc2f866f7..bf66dba52 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#include "../common/cbasetypes.h"
#include "../common/des.h"
@@ -250,8 +251,12 @@ int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned
/// zlib compress
-int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen)
-{
+int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen) {
+ if( *destLen == 0 ) /* [Ind/Hercules] */
+ *destLen = compressBound(sourceLen);
+ if( dest == NULL ) { /* [Ind/Hercules] */
+ CREATE(dest, unsigned char, *destLen);
+ }
return compress((Bytef*)dest, destLen, (const Bytef*)source, sourceLen);
}