GNU bug report logs - #51296
[PATCH] Add WebP format support

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Tue, 19 Oct 2021 23:29:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 51296 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51296 <at> debbugs.gnu.org
Subject: Re: bug#51296: [PATCH] Add WebP format support
Date: Thu, 21 Oct 2021 11:36:45 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, now only a few minor issues remain:

All your comments should be fixed, see below for details.  I've also
attached an updated patch.  Thank you for reviewing.

> That's OK, but I believe you should also add WEBP to the list of Emacs
> configuration features around line 5885 in configure.ac, so that WebP
> support could be reported by system-configuration-features.

Ah, right.  Fixed.

> Our style is to separate the '*' from the type, like this:
>
>   DEF_DLL_FN (int, WebPGetInfo, (const uint8_t *, size_t, int *, int *));
>                                               ^^             ^^     ^^
> Also note that there's no need to use names of parameters in
> prototypes, they just make the code longer, but don't add anything
> useful.  So I removed them in the above.

Fixed.

>> +  if (!(library = w32_delayed_load (Qwebp)))
>> +    return 0;
>        ^^^^^^^^
> "return false" is more consistent.

Fixed.

>> +      contents = (uint8_t*) SSDATA (specified_data);
>
> Space before '*' again.  Also, is the type cast really needed?  If
> not, it is better to drop it.

Fixed the style issue.

The cast fixes this warning, so I kept it and added a comment saying
"Casting avoids a GCC warning":

image.c: In function ‘webp_load’:
image.c:8878:16: warning: pointer targets in assignment from ‘char *’
to ‘uint8_t *’ {aka ‘unsigned char *’} differ in signedness
[-Wpointer-sign]
 8878 |       contents = SSDATA (specified_data);
      |                ^

>> +  /* Validate the WebP image header.  */
>> +  if (!WebPGetInfo (contents, size, NULL, NULL))
>> +    {
>> +      if (!NILP (specified_data))
>> +	image_error ("Not a WebP file: `%s'", file);
>> +      else
>> +	image_error ("Invalid WebP data");
>
> This last error message could IMO be more useful, if it said something
> like "Non-WebP header in WebP image data".

I went with: "Invalid header in WebP image data".

>> +	image_error ("Error when interpreting WebP data: `%s'", file);
>
> Suggest to say "Error when interpreting WebP data from file `%s'"
> instead, otherwise it may not be clear to the user what is that string
> after the colon.
>
>> +	image_error ("Error when interpreting WebP data");
>
> I'd suggest "Error when interpreting WebP image data".

Yes, that's better.  Fixed.
[0001-Add-WebP-format-support.patch (text/x-diff, attachment)]

This bug report was last modified 3 years and 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.