Unbreak webp-pixbuf-loader for big-endian platforms

The patch calls le32toh in <endian.h>, because OpenBSD doesn't have
<byteswap.h>.  This prevents a fatal error on BE_ARCHS when byteswap.h
didn't exist.

ok jsg@ jca@
This commit is contained in:
gkoehler 2022-09-23 02:03:29 +00:00
parent 015bc72900
commit 178cbf016a
2 changed files with 28 additions and 0 deletions

View File

@ -3,6 +3,7 @@ COMMENT= WebP GDK Pixbuf Loader library
GH_ACCOUNT= aruiz
GH_PROJECT= webp-pixbuf-loader
GH_TAGNAME= 0.0.6
REVISION= 0
CATEGORIES= graphics

View File

@ -0,0 +1,27 @@
Use <endian.h>; OpenBSD doesn't have <byteswap.h>.
Index: io-webp.c
--- io-webp.c.orig
+++ io-webp.c
@@ -12,9 +12,7 @@
#include "io-webp.h"
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#include <byteswap.h>
-#endif
+#include <endian.h>
#define IMAGE_READ_BUFFER_SIZE 65535
@@ -278,9 +276,7 @@ gdk_pixbuf__webp_anim_load_increment (gpointer co
/* The next 4 bytes give the size of the webp container less the 8 byte header. */
uint32_t anim_size = *(uint32_t *) (buf + 4); /* gives file size not counting the first 8 bytes. */
- #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
- anim_size = bswap_32(anim_size);
- #endif
+ anim_size = le32toh(anim_size);
uint32_t file_size = anim_size + 8;
if (file_size < size) {