all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 51296@debbugs.gnu.org
Subject: bug#51296: [PATCH] Add WebP format support
Date: Thu, 21 Oct 2021 11:19:44 +0300	[thread overview]
Message-ID: <8335ouaixr.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkm=LmhAhA88OR_FhE-GxAvekWN2DNiVdUc7fxLhw8VEkXQ@mail.gmail.com> (message from Stefan Kangas on Wed, 20 Oct 2021 17:45:28 -0700)

> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 20 Oct 2021 17:45:28 -0700
> Cc: 51296@debbugs.gnu.org
> 
> > Also fixed.
> 
> I spotted a typo, fixed in the attached patch.

Thanks, now only a few minor issues remain:

> +### mingw32 doesn't use -lwebp, since it loads the library dynamically.
> +HAVE_WEBP=no
> +if test "${with_webp}" != "no"; then
> +   if test "$opsys" = mingw32; then
> +      AC_CHECK_HEADER([webp/decode.h], [HAVE_WEBP=yes])
> +   elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
> +         || test "${HAVE_NS}" = "yes"; then
> +      WEBP_REQUIRED=0.6.0
> +      WEBP_MODULE="libwebp >= $WEBP_REQUIRED"
> +
> +      EMACS_CHECK_MODULES([WEBP], [$WEBP_MODULE])
> +      AC_SUBST(WEBP_CFLAGS)
> +      AC_SUBST(WEBP_LIBS)
> +
> +      if test $HAVE_WEBP = yes; then
> +        AC_DEFINE(HAVE_WEBP, 1, [Define to 1 if using libwebp.])
> +        CFLAGS="$CFLAGS $WEBP_CFLAGS"
> +      fi
> +   fi
> +fi

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.

> +DEF_DLL_FN (int, WebPGetInfo, (const uint8_t* data, size_t data_size, int* width, int* height));

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.

> +static bool
> +init_webp_functions (void)
> +{
> +  HMODULE library;
> +
> +  if (!(library = w32_delayed_load (Qwebp)))
> +    return 0;
       ^^^^^^^^
"return false" is more consistent.

> +      contents = (uint8_t*) SSDATA (specified_data);

Space before '*' again.  Also, is the type cast really needed?  If
not, it is better to drop it.

> +  /* 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".

> +	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".





  reply	other threads:[~2021-10-21  8:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 23:27 bug#51296: [PATCH] Add WebP format support Stefan Kangas
2021-10-20  8:42 ` Lars Ingebrigtsen
2021-10-20 12:40   ` Stefan Kangas
2021-10-20 13:02 ` Stefan Kangas
2021-10-20 13:14   ` Eli Zaretskii
2021-10-20 15:22     ` Stefan Kangas
2021-10-20 16:35       ` Eli Zaretskii
2021-10-20 17:13         ` Eli Zaretskii
2021-10-20 17:41           ` Stefan Kangas
2021-10-20 18:19             ` Eli Zaretskii
2021-10-20 21:02         ` Stefan Kangas
2021-10-21  0:45           ` Stefan Kangas
2021-10-21  8:19             ` Eli Zaretskii [this message]
2021-10-21 18:36               ` Stefan Kangas
2021-10-21 18:39                 ` Eli Zaretskii
2021-10-21 21:19                   ` Stefan Kangas
2021-10-22  6:16                     ` Eli Zaretskii
2021-10-22  9:03                       ` Stefan Kangas
2021-10-22 12:06                         ` Eli Zaretskii
2021-10-22 12:47                           ` Eli Zaretskii
2021-10-22 14:27                             ` Stefan Kangas

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=8335ouaixr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=51296@debbugs.gnu.org \
    --cc=stefan@marxist.se \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.