From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alessandro Rubini Date: Wed, 29 Jul 2009 11:20:50 +0200 Subject: [U-Boot] [PATCH] zlib: allow 0 as destination pointer In-Reply-To: <002901ca1029@st.com> References: <002901ca1029@st.com> Message-ID: <20090729092050.GA24275@mail.gnudd.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > Hi rhabarber1848, > please could you test latest two zlib patches I have sent few minutes ago? Unfortunately you add outcb() only in inflatestart and inflateend. IT should also go in the main loop. Being an out-callback with arguments, it should be called during copy to output, with proper arguments (and in that form it would be a fix to the official zlib). I tried this one, which is a quick hack (no arguments passed, so not suitable for upstream zlib in any case). Moreover, one of those two should be sufficient, but I don't know which one exactly. I'm lazy so I won't trace program flow in detail. I think rhabarber should test with this addition too and select which one is the good one. (formatted for git-am for quick testing, even thought he talk is irrelevant as a commit message). ps: please note that your addition of outcb() has white-space inconsistency with zlib.c (which is not u-boot style while those lines are). /alessandro --- lib_generic/zlib.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/lib_generic/zlib.c b/lib_generic/zlib.c index 6a78dc9..66b18eb 100644 --- a/lib_generic/zlib.c +++ b/lib_generic/zlib.c @@ -1129,6 +1129,10 @@ unsigned out; state = (struct inflate_state FAR *)strm->state; + /* call watchdog_reset if needed (addition for U-Boot) */ + if (strm->outcb != Z_NULL) + (*strm->outcb)(Z_NULL, 0); + /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { state->window = (unsigned char FAR *) @@ -1741,6 +1745,8 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: + if (strm->outcb != Z_NULL) /* for watchdog (U-Boot) */ + (*strm->outcb)(Z_NULL, 0); if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); -- 1.6.0.2