]> git.draconx.ca Git - liblbx.git/blobdiff - src/byteorder.h
Fix segfault on EOF in lbximg_fopen().
[liblbx.git] / src / byteorder.h
index 5eb4daf51ddfc32f2728816c4acd1d6fb60cb389..4cf2854424d68514d31981f11c29ca196befad02 100644 (file)
@@ -1,12 +1,12 @@
 #ifndef BYTEORDER_H_
 #define BYTEORDER_H_
 
-#include <stdint.h>
-
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
 #endif
 
+#include <stdint.h>
+
 static inline uint16_t _flip16(uint16_t val)
 {
        uint16_t hostval;
@@ -29,8 +29,8 @@ static inline uint32_t _flip32(uint32_t val)
 #      define letohs(x) _flip16(x)
 #      define letohl(x) _flip32(x)
 #else
-#      define letohs(x) (x)
-#      define letohl(x) (x)
+#      define letohs(x) ((uint16_t)(x))
+#      define letohl(x) ((uint16_t)(x))
 #endif
 
 #endif