All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] PNG image reader
Date: Thu, 24 Jan 2008 13:14:03 +0100	[thread overview]
Message-ID: <87ve5j4e0k.fsf@xs4all.nl> (raw)
In-Reply-To: <ca0f59980801240402g7b725aa0p463aefa24c95252b@mail.gmail.com> (bean123ch@gmail.com's message of "Thu, 24 Jan 2008 20:02:26 +0800")

Bean <bean123ch@gmail.com> writes:

> On Jan 24, 2008 4:29 PM, Marco Gerards <mgerards@xs4all.nl> wrote:
>> Bean <bean123ch@gmail.com> writes:
>>
>> > On Jan 23, 2008 6:36 PM, Marco Gerards <mgerards@xs4all.nl> wrote:
>> >> > static grub_uint32_t
>> >> > grub_png_get_dword (struct grub_png_data *data)
>> >> > {
>> >> >   grub_uint32_t r;
>> >> >
>> >> >   r = 0;
>> >>
>> >> Why this?
>> >
>> > just to make sure if grub_file_read fails, this function will return 0.
>>
>> It would better to do proper error handling.  This error is never
>> picked up...  How about:
>>
>> static grub_err_t
>> grub_png_get_dword (struct grub_png_data *data,  grub_uint32_t *val)
>>
>>
>
> because grub_png_get_byte and grub_png_get_dword appear in many
> places, checking every call is not efficient. i have added test in
> critical place to ensure error will be caught. however, if you think
> strict checking is necessary, i can make the change.

It would be nice, not required.  I don't expect too much problems
here...

Perhaps a better approach would be possible to do a check after
reading a size:

int size = foo();

Check the size of the file here

while (size--)
{
  read pixels;
}


Or just check for grub_errno or so after reading the picture?

--
Marco




  reply	other threads:[~2008-01-24 12:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 23:14 [PATCH] PNG image reader Bean
2008-01-12  5:45 ` Bean
2008-01-14 17:12   ` Bean
2008-01-23 10:36     ` Marco Gerards
2008-01-23 18:12       ` Bean
2008-01-24  8:29         ` Marco Gerards
2008-01-24 12:02           ` Bean
2008-01-24 12:14             ` Marco Gerards [this message]
2008-01-24 12:59               ` Bean
2008-01-25  9:05                 ` Marco Gerards
2008-01-26 13:19                   ` Bean
2008-01-29  9:10                     ` Marco Gerards
2008-01-29  9:45                       ` Bean

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=87ve5j4e0k.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --cc=grub-devel@gnu.org \
    /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.