- use types of appropriate size if stdint.h is available
authorJörg Hoh <hohjg@users.sourceforge.net>
Thu, 1 Apr 2004 20:24:22 +0000 (22:24 +0200)
committerJörg Hoh <hohjg@users.sourceforge.net>
Thu, 1 Apr 2004 20:24:22 +0000 (22:24 +0200)
libexif/exif-utils.h

index 3409522..6f3a25f 100644 (file)
@@ -27,6 +27,21 @@ extern "C" {
 
 #include <libexif/exif-byte-order.h>
 
+/* Works correct only on machines with a stdint.h, otherwise it assumes
+ * sizeof(long) == 4                                                    */
+  
+#ifdef HAVE_INTTYPES_H
+#include <stdint.h>
+typedef char           ExifByte;          /* 1 byte  */
+typedef char *         ExifAscii;
+typedef uint16_t       ExifShort;         /* 2 bytes */
+typedef uint32_t       ExifLong;          /* 4 bytes */
+typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
+typedef char           ExifUndefined;     /* 1 byte  */
+typedef int32_t                ExifSLong;         /* 4 bytes */
+typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
+
+#else
 typedef char           ExifByte;          /* 1 byte  */
 typedef char *         ExifAscii;
 typedef unsigned short ExifShort;         /* 2 bytes */
@@ -35,7 +50,7 @@ typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
 typedef char           ExifUndefined;     /* 1 byte  */
 typedef signed long    ExifSLong;         /* 4 bytes */
 typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
-
+#endif
 
 ExifShort     exif_get_short     (const unsigned char *b, ExifByteOrder order);
 ExifLong      exif_get_long      (const unsigned char *b, ExifByteOrder order);