From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JI0ws-0005lU-2N for mharc-grub-devel@gnu.org; Thu, 24 Jan 2008 07:12:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JI0wq-0005jG-93 for grub-devel@gnu.org; Thu, 24 Jan 2008 07:12:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JI0wn-0005fp-Qg for grub-devel@gnu.org; Thu, 24 Jan 2008 07:12:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JI0wn-0005fe-NR for grub-devel@gnu.org; Thu, 24 Jan 2008 07:12:45 -0500 Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JI0wn-0004JC-9W for grub-devel@gnu.org; Thu, 24 Jan 2008 07:12:45 -0500 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id m0OCCiFS082793 for ; Thu, 24 Jan 2008 13:12:44 +0100 (CET) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <87d4rssu9h.fsf@xs4all.nl> <87r6g7zkx3.fsf@xs4all.nl> Mail-Copies-To: mgerards@xs4all.nl Date: Thu, 24 Jan 2008 13:14:03 +0100 In-Reply-To: (bean123ch@gmail.com's message of "Thu, 24 Jan 2008 20:02:26 +0800") Message-ID: <87ve5j4e0k.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Subject: Re: [PATCH] PNG image reader X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2008 12:12:49 -0000 Bean writes: > On Jan 24, 2008 4:29 PM, Marco Gerards wrote: >> Bean writes: >> >> > On Jan 23, 2008 6:36 PM, Marco Gerards 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