This function used to take a zlib-specific flag as argument to indicate whether a buffer flush or end of contents was met, let's split it in two so that we don't depend on zlib anymore.