4206909 - adding Z_SYNC_FLUSH support to deflaters

Brandon Long blong at google.com
Fri Sep 4 00:08:59 UTC 2009


On 09/03/09 Martin Buchholz uttered the following other thing:
> 
> ---
>  178     public int available() throws IOException {
>  179         ensureOpen();
>  180         if (reachEOF) {
>  181             return 0;
>  182         } else {
>  183             if (inf.needsInput())
>  184                 return in.available();
> 
> Even if you could deal with the compatibility problems of applications
> relying on the 1/0 existing specified behavior, this code
> seems wrong because an inflater might possibly shrink the input.
> Maybe you can use something like deflateBounds?

My version just returned 1 in this case, though even that might not be
true, but it was no worse than the current always return 1.  Its a
pretty grey area, maybe deflateBounds would get closer to the truth.
Another option would be to try and to inflate a single byte or some
bounded number.

Brandon

-- 
 "Its much more fun to be sand than oil in the machinery of life."
                                           http://www.fiction.net/blong/



More information about the core-libs-dev mailing list