Don't ignore the return value from deflateEnd.
Remove decrement of the destination length by one, when setting up for
compression: one version of this code reserved a byte to figure out
whether there were multiple blocks to inflate, but that isn't necessary
for zlib.
Don't loop on calls to deflate until Z_OK isn't returned, we're not adding
additional buffer memory so no progress can be made (in other words, a Z_OK
return from deflate means compression wasn't successful).