diff options
Diffstat (limited to 'rd')
-rw-r--r-- | rd/read-bmp.c | 31 | ||||
-rw-r--r-- | rd/read-gif.c | 14 | ||||
-rw-r--r-- | rd/read-jpeg.c | 14 | ||||
-rw-r--r-- | rd/read-png.c | 14 |
4 files changed, 29 insertions, 44 deletions
diff --git a/rd/read-bmp.c b/rd/read-bmp.c index f92a808..8008a41 100644 --- a/rd/read-bmp.c +++ b/rd/read-bmp.c @@ -3,30 +3,15 @@ #include <stddef.h> #include <string.h> #include <errno.h> -#include <endian.h> #include "readers.h" +#include "byteorder.h" /* ---------------------------------------------------------------------- */ typedef unsigned int uint32; typedef unsigned short uint16; -/* bitmap files are little endian */ -#if BYTE_ORDER == LITTLE_ENDIAN -# define le16_to_cpu(x) (x) -# define le32_to_cpu(x) (x) -#elif BYTE_ORDER == BIG_ENDIAN -# define le16_to_cpu(x) (((x>>8) & 0x00ff) |\ - ((x<<8) & 0xff00)) -# define le32_to_cpu(x) (((x>>24) & 0x000000ff) |\ - ((x>>8) & 0x0000ff00) |\ - ((x<<8) & 0x00ff0000) |\ - ((x<<24) & 0xff000000)) -#else -# error "Oops: unknown byte order" -#endif - /* ---------------------------------------------------------------------- */ /* load */ @@ -200,13 +185,13 @@ bmp_done(void *data) } static struct ida_loader bmp_loader = { - magic: "BM", - moff: 0, - mlen: 2, - name: "bmp", - init: bmp_init, - read: bmp_read, - done: bmp_done, + .magic = "BM", + .moff = 0, + .mlen = 2, + .name = "bmp", + .init = bmp_init, + .read = bmp_read, + .done = bmp_done, }; static void __init init_rd(void) diff --git a/rd/read-gif.c b/rd/read-gif.c index 27c53a8..f747b88 100644 --- a/rd/read-gif.c +++ b/rd/read-gif.c @@ -220,13 +220,13 @@ gif_done(void *data) } static struct ida_loader gif_loader = { - magic: "GIF", - moff: 0, - mlen: 3, - name: "giflib", - init: gif_init, - read: gif_read, - done: gif_done, + .magic = "GIF", + .moff = 0, + .mlen = 3, + .name = "giflib", + .init = gif_init, + .read = gif_read, + .done = gif_done, }; static void __init init_rd(void) diff --git a/rd/read-jpeg.c b/rd/read-jpeg.c index b6b13f6..b42b574 100644 --- a/rd/read-jpeg.c +++ b/rd/read-jpeg.c @@ -194,13 +194,13 @@ jpeg_done(void *data) } struct ida_loader jpeg_loader = { - magic: "\xff\xd8", - moff: 0, - mlen: 2, - name: "libjpeg", - init: jpeg_init, - read: jpeg_read, - done: jpeg_done, + .magic = "\xff\xd8", + .moff = 0, + .mlen = 2, + .name = "libjpeg", + .init = jpeg_init, + .read = jpeg_read, + .done = jpeg_done, }; static void __init init_rd(void) diff --git a/rd/read-png.c b/rd/read-png.c index f06ed6d..618c6f5 100644 --- a/rd/read-png.c +++ b/rd/read-png.c @@ -150,13 +150,13 @@ png_done(void *data) } static struct ida_loader png_loader = { - magic: "\x89PNG", - moff: 0, - mlen: 4, - name: "libpng", - init: png_init, - read: png_read, - done: png_done, + .magic = "\x89PNG", + .moff = 0, + .mlen = 4, + .name = "libpng", + .init = png_init, + .read = png_read, + .done = png_done, }; static void __init init_rd(void) |