aboutsummaryrefslogtreecommitdiffstats
path: root/rd/read-bmp.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-05-08 13:22:33 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-08 13:22:33 +0200
commit8fc776833f83c417d57c43f41479bc034c3863c6 (patch)
tree2fbe3cd51de3947f8fc5144d17b2bd57eccb6271 /rd/read-bmp.c
parent63b5412f8c410694e8c67452452273ae8a9a6871 (diff)
downloadfbida-8fc776833f83c417d57c43f41479bc034c3863c6.tar.gz
portability fixes, some modernization
Diffstat (limited to 'rd/read-bmp.c')
-rw-r--r--rd/read-bmp.c31
1 files changed, 8 insertions, 23 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)