[PATCH 1/9] Use stdint.h instead of assuming the size of types

Adrian Johnson ajohnson at redneon.com
Tue Aug 9 05:35:53 PDT 2011


---
 configure.ac               |    1 +
 goo/gtypes.h               |   18 ++++++++++++++++++
 poppler/CairoOutputDev.cc  |    2 --
 poppler/CairoRescaleBox.cc |    2 --
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index b7af92b..8afb13b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,7 @@ AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
 dnl ##### Checks for header files.
 AC_PATH_XTRA
 AC_HEADER_DIRENT
+AC_CHECK_HEADERS([stdint.h])
 
 dnl ##### Switch over to C++.  This will make the checks below a little
 dnl ##### bit stricter (requiring function prototypes in include files).
diff --git a/goo/gtypes.h b/goo/gtypes.h
index b7a2dd2..cb1cb89 100644
--- a/goo/gtypes.h
+++ b/goo/gtypes.h
@@ -24,6 +24,8 @@
 #ifndef GTYPES_H
 #define GTYPES_H
 
+#include "config.h"
+
 /*
  * These have stupid names to avoid conflicts with some (but not all)
  * C++ compilers which define them.
@@ -45,4 +47,20 @@ typedef unsigned short Gushort;
 typedef unsigned int Guint;
 typedef unsigned long Gulong;
 
+/*
+ * Define precise integer types.
+ */
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif _MSC_VER
+typedef signed   __int8  int8_t;
+typedef unsigned __int8  uint8_t;
+typedef signed   __int16 int16_t;
+typedef unsigned __int16 uint16_t;
+typedef signed   __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef signed   __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#endif
+
 #endif
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 477030a..6e7fd53 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1343,8 +1343,6 @@ void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbo
   popTransparencyGroup();
 }
 
-typedef unsigned int uint32_t;
-
 static uint32_t luminocity(uint32_t x)
 {
   int r = (x >> 16) & 0xff;
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index dce5ddd..fea5891 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -37,8 +37,6 @@
 #include "goo/gmem.h"
 #include "CairoRescaleBox.h"
 
-typedef unsigned short int      uint16_t;
-typedef unsigned int            uint32_t;
 
 /* we work in fixed point where 1. == 1 << 24 */
 #define FIXED_SHIFT 24
-- 
1.7.4.1


--------------010201060309050309080107
Content-Type: text/x-patch;
 name="0003-png-Add-additional-pixel-formats.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-png-Add-additional-pixel-formats.patch"



More information about the poppler mailing list