From 64e55048c7c7096a0d437dec262b4988c5bbad7f Mon Sep 17 00:00:00 2001 From: Phillip Lougher Date: Wed, 23 Sep 2009 15:57:37 -0700 Subject: [PATCH] --- yaml --- r: 165717 b: refs/heads/master c: 6a8811629e9aa611aa710162f9e02020bba52c87 h: refs/heads/master i: 165715: 2ca1161842d13c5c1b21b9e2f93fc10b246b7ada v: v3 --- [refs] | 2 +- trunk/lib/decompress_inflate.c | 8 ++++++++ trunk/lib/decompress_unlzma.c | 10 +++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 317a339f9887..b627399fcc9e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3354f73b24c6d392ed7fd5583cfcc7604c1934ae +refs/heads/master: 6a8811629e9aa611aa710162f9e02020bba52c87 diff --git a/trunk/lib/decompress_inflate.c b/trunk/lib/decompress_inflate.c index 68dfce59c1b8..fc686c7a0a0d 100644 --- a/trunk/lib/decompress_inflate.c +++ b/trunk/lib/decompress_inflate.c @@ -27,6 +27,11 @@ #define GZIP_IOBUF_SIZE (16*1024) +static int nofill(void *buffer, unsigned int len) +{ + return -1; +} + /* Included from initramfs et al code */ STATIC int INIT gunzip(unsigned char *buf, int len, int(*fill)(void*, unsigned int), @@ -76,6 +81,9 @@ STATIC int INIT gunzip(unsigned char *buf, int len, goto gunzip_nomem4; } + if (!fill) + fill = nofill; + if (len == 0) len = fill(zbuf, GZIP_IOBUF_SIZE); diff --git a/trunk/lib/decompress_unlzma.c b/trunk/lib/decompress_unlzma.c index 0b954e04bd30..ca82fde81c8f 100644 --- a/trunk/lib/decompress_unlzma.c +++ b/trunk/lib/decompress_unlzma.c @@ -82,6 +82,11 @@ struct rc { #define RC_MODEL_TOTAL_BITS 11 +static int nofill(void *buffer, unsigned int len) +{ + return -1; +} + /* Called twice: once at startup and once in rc_normalize() */ static void INIT rc_read(struct rc *rc) { @@ -97,7 +102,10 @@ static inline void INIT rc_init(struct rc *rc, int (*fill)(void*, unsigned int), char *buffer, int buffer_size) { - rc->fill = fill; + if (fill) + rc->fill = fill; + else + rc->fill = nofill; rc->buffer = (uint8_t *)buffer; rc->buffer_size = buffer_size; rc->buffer_end = rc->buffer + rc->buffer_size;