grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] PNG image reader


From: Marco Gerards
Subject: Re: [PATCH] PNG image reader
Date: Thu, 24 Jan 2008 13:14:03 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Bean <address@hidden> writes:

> On Jan 24, 2008 4:29 PM, Marco Gerards <address@hidden> wrote:
>> Bean <address@hidden> writes:
>>
>> > On Jan 23, 2008 6:36 PM, Marco Gerards <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]