aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-06-20 16:54:07 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-20 21:18:14 +0200
commitb856379370809cca68cb97b737284ade2c44765c (patch)
tree13b736587831ba3fc745425021a41e35314ae502
parent92c94e7df230dd86eb46e8edf8e9d92531d5f6ef (diff)
downloadqpdf-b856379370809cca68cb97b737284ade2c44765c.tar.zst
Portability issues: off_t, unlink
New header qpdf/Types.h attempts to make sure size_t and off_t are defined on any platform and in a way that would work with large file support. Additionally, missing header files are included to get unlink.
-rw-r--r--examples/pdf-mod-info.cc7
-rw-r--r--include/qpdf/QPDF.hh1
-rw-r--r--include/qpdf/QPDFExc.hh1
-rw-r--r--include/qpdf/QPDFObjectHandle.hh1
-rw-r--r--include/qpdf/QPDFXRefEntry.hh1
-rw-r--r--include/qpdf/Types.h16
6 files changed, 27 insertions, 0 deletions
diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc
index ef5a280d..84cc8415 100644
--- a/examples/pdf-mod-info.cc
+++ b/examples/pdf-mod-info.cc
@@ -8,6 +8,13 @@
#include <iostream>
#include <string.h>
#include <stdlib.h>
+#ifdef _WIN32
+#include <Windows.h>
+#include <direct.h>
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
static char const* version = "1.1";
static char const* whoami = 0;
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index dc2b4c22..6a9728b1 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -15,6 +15,7 @@
#include <iostream>
#include <qpdf/DLL.h>
+#include <qpdf/Types.h>
#include <qpdf/QPDFXRefEntry.hh>
#include <qpdf/QPDFObjectHandle.hh>
diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh
index 3d04c601..26d0a315 100644
--- a/include/qpdf/QPDFExc.hh
+++ b/include/qpdf/QPDFExc.hh
@@ -10,6 +10,7 @@
#include <qpdf/DLL.h>
#include <qpdf/Constants.h>
+#include <qpdf/Types.h>
#include <stdexcept>
class QPDFExc: public std::runtime_error
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 9873da7b..6213ff10 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -14,6 +14,7 @@
#include <map>
#include <qpdf/DLL.h>
+#include <qpdf/Types.h>
#include <qpdf/PointerHolder.hh>
#include <qpdf/Buffer.hh>
diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh
index a828a4ee..35843970 100644
--- a/include/qpdf/QPDFXRefEntry.hh
+++ b/include/qpdf/QPDFXRefEntry.hh
@@ -9,6 +9,7 @@
#define __QPDFXREFENTRY_HH__
#include <qpdf/DLL.h>
+#include <qpdf/Types.h>
class QPDFXRefEntry
{
diff --git a/include/qpdf/Types.h b/include/qpdf/Types.h
new file mode 100644
index 00000000..4041ce3a
--- /dev/null
+++ b/include/qpdf/Types.h
@@ -0,0 +1,16 @@
+#ifndef __QPDFTYPES_H__
+#define __QPDFTYPES_H__
+
+/* Attempt to provide off_t and size_t on any recent platform. To
+ * make cross compilation easier and to be more portable across
+ * platforms, QPDF avoids having any public header files use the
+ * results of autoconf testing, so we have to handle this ourselves in
+ * a static way.
+ */
+
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+
+#endif /* __QPDFTYPES_H__ */