version 1.5, 2000/03/16 20:56:14 |
version 1.6, 2000/03/28 20:25:14 |
|
|
case Z_OK: |
case Z_OK: |
/* Append compressed data to output_buffer. */ |
/* Append compressed data to output_buffer. */ |
buffer_append(output_buffer, buf, |
buffer_append(output_buffer, buf, |
sizeof(buf) - outgoing_stream.avail_out); |
sizeof(buf) - outgoing_stream.avail_out); |
break; |
break; |
case Z_STREAM_END: |
|
fatal("buffer_compress: deflate returned Z_STREAM_END"); |
|
/* NOTREACHED */ |
|
case Z_STREAM_ERROR: |
|
fatal("buffer_compress: deflate returned Z_STREAM_ERROR"); |
|
/* NOTREACHED */ |
|
case Z_BUF_ERROR: |
|
fatal("buffer_compress: deflate returned Z_BUF_ERROR"); |
|
/* NOTREACHED */ |
|
default: |
default: |
fatal("buffer_compress: deflate returned %d", status); |
fatal("buffer_compress: deflate returned %d", status); |
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
} |
} while (outgoing_stream.avail_out == 0); |
while (outgoing_stream.avail_out == 0); |
|
} |
} |
|
|
/* |
/* |
|
|
incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); |
incoming_stream.next_in = (unsigned char *) buffer_ptr(input_buffer); |
incoming_stream.avail_in = buffer_len(input_buffer); |
incoming_stream.avail_in = buffer_len(input_buffer); |
|
|
incoming_stream.next_out = (unsigned char *) buf; |
|
incoming_stream.avail_out = sizeof(buf); |
|
|
|
for (;;) { |
for (;;) { |
|
/* Set up fixed-size output buffer. */ |
|
incoming_stream.next_out = (unsigned char *) buf; |
|
incoming_stream.avail_out = sizeof(buf); |
|
|
status = inflate(&incoming_stream, Z_PARTIAL_FLUSH); |
status = inflate(&incoming_stream, Z_PARTIAL_FLUSH); |
switch (status) { |
switch (status) { |
case Z_OK: |
case Z_OK: |
buffer_append(output_buffer, buf, |
buffer_append(output_buffer, buf, |
sizeof(buf) - incoming_stream.avail_out); |
sizeof(buf) - incoming_stream.avail_out); |
incoming_stream.next_out = (unsigned char *) buf; |
|
incoming_stream.avail_out = sizeof(buf); |
|
break; |
break; |
case Z_STREAM_END: |
|
fatal("buffer_uncompress: inflate returned Z_STREAM_END"); |
|
/* NOTREACHED */ |
|
case Z_DATA_ERROR: |
|
fatal("buffer_uncompress: inflate returned Z_DATA_ERROR"); |
|
/* NOTREACHED */ |
|
case Z_STREAM_ERROR: |
|
fatal("buffer_uncompress: inflate returned Z_STREAM_ERROR"); |
|
/* NOTREACHED */ |
|
case Z_BUF_ERROR: |
case Z_BUF_ERROR: |
/* |
/* |
* Comments in zlib.h say that we should keep calling |
* Comments in zlib.h say that we should keep calling |
|
|
* be the error that we get. |
* be the error that we get. |
*/ |
*/ |
return; |
return; |
case Z_MEM_ERROR: |
|
fatal("buffer_uncompress: inflate returned Z_MEM_ERROR"); |
|
/* NOTREACHED */ |
|
default: |
default: |
fatal("buffer_uncompress: inflate returned %d", status); |
fatal("buffer_uncompress: inflate returned %d", status); |
|
/* NOTREACHED */ |
} |
} |
} |
} |
} |
} |