Fix non-portable zlib compression/decompression code.

This will make 64bit host work and gets rid of the
"Client cannot receive packet or key is invalid".

Tested on x86_64 Arch Linux.
Looking for somebody to test 64bit on Windows and 32bit too for regressions.
Merge pull request #441 from Cloudef/fix/x86_64

Fix non-portable zlib compression/decompression code.