This allows the caller to easily detect how much of the destination buffer
has been used.
Signed-off-by: Simon Glass <sjg@chromium.org>
int stoponerr, int offset)
{
z_stream s;
+ int err = 0;
int r;
s.zalloc = gzalloc;
if (stoponerr == 1 && r != Z_STREAM_END &&
(s.avail_out == 0 || r != Z_BUF_ERROR)) {
printf("Error: inflate() returned %d\n", r);
- inflateEnd(&s);
- return -1;
+ err = -1;
+ break;
}
s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
} while (r == Z_BUF_ERROR);
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
- return 0;
+ return err;
}