[POWERPC] boot: Simplify gunzip_finish
Call gunzip_partial to calculate the remaining length and copy the data to the user buffer. This makes it shorter and reduces duplication. Signed-off-by: Milton Miller <miltonm@bga.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
e47654d016
commit
51a505d73b
|
@ -194,13 +194,10 @@ int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (state->s.workspace) {
|
|
||||||
len = gunzip_partial(state, dst, dstlen);
|
len = gunzip_partial(state, dst, dstlen);
|
||||||
|
|
||||||
|
if (state->s.workspace) {
|
||||||
zlib_inflateEnd(&state->s);
|
zlib_inflateEnd(&state->s);
|
||||||
} else {
|
|
||||||
/* uncompressed image */
|
|
||||||
len = min(state->s.avail_in, (unsigned)dstlen);
|
|
||||||
memcpy(dst, state->s.next_in, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|
Loading…
Reference in New Issue