All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
@ 2011-02-04 12:35 Catalin Radu
  2011-02-05  9:42 ` Albert ARIBAUD
  2011-04-12 19:05 ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Catalin Radu @ 2011-02-04 12:35 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Catalin Radu <Catalin@VirtualMetrix.com>
---
 lib/gunzip.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/gunzip.c b/lib/gunzip.c
index 482a476..8b16b24 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -106,12 +106,16 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
 	s.avail_in = *lenp - offset;
 	s.next_out = dst;
 	s.avail_out = dstlen;
-	r = inflate(&s, Z_FINISH);
-	if ((r != Z_STREAM_END) && (stoponerr==1)) {
-		printf ("Error: inflate() returned %d\n", r);
-		inflateEnd(&s);
-		return (-1);
-	}
+	do {
+		r = inflate(&s, Z_FINISH);
+		if (r != Z_STREAM_END && r != Z_BUF_ERROR && stoponerr == 1) {
+			printf("Error: inflate() returned %d\n", r);
+			inflateEnd(&s);
+			return -1;
+		}
+		s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
+		s.avail_out = dstlen;
+	} while (r == Z_BUF_ERROR);
 	*lenp = s.next_out - (unsigned char *) dst;
 	inflateEnd(&s);
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
  2011-02-04 12:35 [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size Catalin Radu
@ 2011-02-05  9:42 ` Albert ARIBAUD
  2011-04-12 19:05 ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Albert ARIBAUD @ 2011-02-05  9:42 UTC (permalink / raw)
  To: u-boot

Le 04/02/2011 13:35, Catalin Radu a ?crit :
>
> Signed-off-by: Catalin Radu<Catalin@VirtualMetrix.com>

This is a V2 patch, right? So it should be marked as such and patch 
history should be added, see

<http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions>

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
  2011-02-04 12:35 [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size Catalin Radu
  2011-02-05  9:42 ` Albert ARIBAUD
@ 2011-04-12 19:05 ` Wolfgang Denk
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2011-04-12 19:05 UTC (permalink / raw)
  To: u-boot

Dear Catalin Radu,

In message <1296822947-6320-1-git-send-email-Catalin@VirtualMetrix.com> you wrote:
> 
> Signed-off-by: Catalin Radu <Catalin@VirtualMetrix.com>
> ---
>  lib/gunzip.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Computers are not intelligent.  They only think they are.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
  2011-02-04  5:23 ` Anthony Foiani
@ 2011-02-04 11:41   ` Catalin Radu
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Radu @ 2011-02-04 11:41 UTC (permalink / raw)
  To: u-boot

Anthony Foiani wrote:
> Catalin, greetings!
>
> Some very minor code style issues that I noticed.  All cosmetic.
>
> Catalin Radu <Catalin@VirtualMetrix.com> writes:
>
>   
>> Signed-off-by: Catalin Radu <Catalin@VirtualMetrix.com>
>> ---
>>  lib/gunzip.c |   16 ++++++++++------
>>  1 files changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/lib/gunzip.c b/lib/gunzip.c
>> index 482a476..2922608 100644
>> --- a/lib/gunzip.c
>> +++ b/lib/gunzip.c
>> @@ -106,12 +106,16 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
>>  	s.avail_in = *lenp - offset;
>>  	s.next_out = dst;
>>  	s.avail_out = dstlen;
>> -	r = inflate(&s, Z_FINISH);
>> -	if ((r != Z_STREAM_END) && (stoponerr==1)) {
>> -		printf ("Error: inflate() returned %d\n", r);
>> -		inflateEnd(&s);
>> -		return (-1);
>> -	}
>> +	do {
>> +		r = inflate(&s, Z_FINISH);
>>     
>
> Space after function name?
>
>   
>> +		if ((r != Z_STREAM_END)&&  (r != Z_BUF_ERROR)&&  (stoponerr==1)) {
>>     
>
> Inconsistent spacing around && operator.
>
> Parentheses around each condition are unnecessary (both "==" and "!="
> bind tighter than "&&"), but I suppose that's basically personal
> preference (and the code being replaced did it that way.)
>
>   
>> +			printf ("Error: inflate() returned %d\n", r);
>> +			inflateEnd(&s);
>>     
>
> Space after function name?
>
>   
>> +	   		return (-1);
>>     
>
> These parentheses are unnecessary.  (Another question of taste:
> "return" is a keyword, not a function.)
>
>   
>> +	   	}
>> +		s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
>> +		s.avail_out = dstlen;
>> +	} while (r == Z_BUF_ERROR);
>>  	*lenp = s.next_out - (unsigned char *) dst;
>>  	inflateEnd(&s);
>>     
>
> Space after function name?
>
> As I said, all totally trivial, but especially those "&&  " caught my eye.  :)
>
> Best regards,
> Tony
>   
Greetings Tony,

Thanks for the formatting observations. I will resend the re-formatted 
patch.

Regards,
Catalin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
  2011-02-03 13:32 Catalin Radu
@ 2011-02-04  5:23 ` Anthony Foiani
  2011-02-04 11:41   ` Catalin Radu
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Foiani @ 2011-02-04  5:23 UTC (permalink / raw)
  To: u-boot


Catalin, greetings!

Some very minor code style issues that I noticed.  All cosmetic.

Catalin Radu <Catalin@VirtualMetrix.com> writes:

> Signed-off-by: Catalin Radu <Catalin@VirtualMetrix.com>
> ---
>  lib/gunzip.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/lib/gunzip.c b/lib/gunzip.c
> index 482a476..2922608 100644
> --- a/lib/gunzip.c
> +++ b/lib/gunzip.c
> @@ -106,12 +106,16 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
>  	s.avail_in = *lenp - offset;
>  	s.next_out = dst;
>  	s.avail_out = dstlen;
> -	r = inflate(&s, Z_FINISH);
> -	if ((r != Z_STREAM_END) && (stoponerr==1)) {
> -		printf ("Error: inflate() returned %d\n", r);
> -		inflateEnd(&s);
> -		return (-1);
> -	}
> +	do {
> +		r = inflate(&s, Z_FINISH);

Space after function name?

> +		if ((r != Z_STREAM_END)&&  (r != Z_BUF_ERROR)&&  (stoponerr==1)) {

Inconsistent spacing around && operator.

Parentheses around each condition are unnecessary (both "==" and "!="
bind tighter than "&&"), but I suppose that's basically personal
preference (and the code being replaced did it that way.)

> +			printf ("Error: inflate() returned %d\n", r);
> +			inflateEnd(&s);

Space after function name?

> +	   		return (-1);

These parentheses are unnecessary.  (Another question of taste:
"return" is a keyword, not a function.)

> +	   	}
> +		s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
> +		s.avail_out = dstlen;
> +	} while (r == Z_BUF_ERROR);
>  	*lenp = s.next_out - (unsigned char *) dst;
>  	inflateEnd(&s);

Space after function name?

As I said, all totally trivial, but especially those "&&  " caught my eye.  :)

Best regards,
Tony

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
@ 2011-02-03 13:32 Catalin Radu
  2011-02-04  5:23 ` Anthony Foiani
  0 siblings, 1 reply; 6+ messages in thread
From: Catalin Radu @ 2011-02-03 13:32 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Catalin Radu <Catalin@VirtualMetrix.com>
---
 lib/gunzip.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/gunzip.c b/lib/gunzip.c
index 482a476..2922608 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -106,12 +106,16 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
 	s.avail_in = *lenp - offset;
 	s.next_out = dst;
 	s.avail_out = dstlen;
-	r = inflate(&s, Z_FINISH);
-	if ((r != Z_STREAM_END) && (stoponerr==1)) {
-		printf ("Error: inflate() returned %d\n", r);
-		inflateEnd(&s);
-		return (-1);
-	}
+	do {
+		r = inflate(&s, Z_FINISH);
+		if ((r != Z_STREAM_END)&&  (r != Z_BUF_ERROR)&&  (stoponerr==1)) {
+			printf ("Error: inflate() returned %d\n", r);
+			inflateEnd(&s);
+	   		return (-1);
+	   	}
+		s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
+		s.avail_out = dstlen;
+	} while (r == Z_BUF_ERROR);
 	*lenp = s.next_out - (unsigned char *) dst;
 	inflateEnd(&s);
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-12 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04 12:35 [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size Catalin Radu
2011-02-05  9:42 ` Albert ARIBAUD
2011-04-12 19:05 ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2011-02-03 13:32 Catalin Radu
2011-02-04  5:23 ` Anthony Foiani
2011-02-04 11:41   ` Catalin Radu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.