All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Radu <Catalin@VirtualMetrix.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix gunzip to work for any gziped uImage size
Date: Fri, 04 Feb 2011 13:41:17 +0200	[thread overview]
Message-ID: <4D4BE5DD.1010709@VirtualMetrix.com> (raw)
In-Reply-To: <gvd10qsnu.fsf@dworkin.scrye.com>

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

  reply	other threads:[~2011-02-04 11:41 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4BE5DD.1010709@VirtualMetrix.com \
    --to=catalin@virtualmetrix.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.