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.