Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2:Update
imlib
imlib-1.9.10-load.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File imlib-1.9.10-load.diff of Package imlib
--- imlib-1.9.14/Imlib/load.c +++ imlib-1.9.14/Imlib/load.c @@ -3,6 +3,7 @@ #include "Imlib.h" #include "Imlib_private.h" #include <setjmp.h> +#include <endian.h> /* Split the ID - damages input */ @@ -594,7 +595,8 @@ linesize, linepos, rshift, gshift, bshift, size; unsigned char byte; short int word; - long int dbuf[4], dword, rmask, gmask, bmask, offset; + int32_t dbuf[4]; + long int dword, rmask, gmask, bmask, offset; signed char bbuf[4]; struct _cmap { @@ -625,12 +627,22 @@ fread(dbuf, 4, 4, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_32(dbuf[0]); + __bswap_32(dbuf[2]); +#endif size = dbuf[0]; offset = dbuf[2]; fread(dbuf, 4, 2, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_32(dbuf[0]); + __bswap_32(dbuf[1]); +#endif + *w = (int)dbuf[0]; *h = (int)dbuf[1]; + if (*w > 32767) { fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for file\n"); @@ -642,8 +654,16 @@ return NULL; } fread(&word, 2, 1, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_16(word); +#endif + planes = (int)word; fread(&word, 2, 1, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_16(word); +#endif + bpp = (int)word; if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32) { @@ -651,6 +671,9 @@ return NULL; } fread(dbuf, 4, 4, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_32(dbuf[0]); +#endif comp = (int)dbuf[0]; if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS) { @@ -658,6 +681,9 @@ return NULL; } fread(dbuf, 4, 2, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_32(dbuf[0]); +#endif ncolors = (int)dbuf[0]; if (ncolors == 0) ncolors = 1 << bpp; @@ -708,6 +734,11 @@ int bit = 0; fread(dbuf, 4, 3, file); +#if __BYTE_ORDER == __BIG_ENDIAN + __bswap_32(dbuf[0]); + __bswap_32(dbuf[1]); + __bswap_32(dbuf[2]); +#endif bmask = dbuf[0]; gmask = dbuf[1]; rmask = dbuf[2];
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor