summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-04-21 16:22:20 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-04-27 15:12:01 +0200
commit9534243f6849d1938195c1f27adaa5745056f138 (patch)
treebc992482d97560154af0a576d052c78cda6bb4ab /source/pdf
parent78c1264e14804a06c6d03072c8c57820fde4e148 (diff)
downloadmupdf-9534243f6849d1938195c1f27adaa5745056f138.tar.xz
Include required system headers.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-annot-edit.c3
-rw-r--r--source/pdf/pdf-annot.c3
-rw-r--r--source/pdf/pdf-appearance.c4
-rw-r--r--source/pdf/pdf-clean-file.c3
-rw-r--r--source/pdf/pdf-clean.c1
-rw-r--r--source/pdf/pdf-cmap-load.c1
-rw-r--r--source/pdf/pdf-cmap-parse.c3
-rw-r--r--source/pdf/pdf-cmap-table.c3
-rw-r--r--source/pdf/pdf-cmap.c4
-rw-r--r--source/pdf/pdf-colorspace.c3
-rw-r--r--source/pdf/pdf-crypt.c3
-rw-r--r--source/pdf/pdf-device.c1
-rw-r--r--source/pdf/pdf-encoding.c4
-rw-r--r--source/pdf/pdf-field.c3
-rw-r--r--source/pdf/pdf-font.c3
-rw-r--r--source/pdf/pdf-form.c3
-rw-r--r--source/pdf/pdf-function.c12
-rw-r--r--source/pdf/pdf-graft.c1
-rw-r--r--source/pdf/pdf-image.c3
-rw-r--r--source/pdf/pdf-interpret.c4
-rw-r--r--source/pdf/pdf-js.c4
-rw-r--r--source/pdf/pdf-layer.c3
-rw-r--r--source/pdf/pdf-lex.c3
-rw-r--r--source/pdf/pdf-metrics.c3
-rw-r--r--source/pdf/pdf-nametree.c1
-rw-r--r--source/pdf/pdf-object.c5
-rw-r--r--source/pdf/pdf-op-buffer.c1
-rw-r--r--source/pdf/pdf-op-filter.c3
-rw-r--r--source/pdf/pdf-op-run.c4
-rw-r--r--source/pdf/pdf-outline.c1
-rw-r--r--source/pdf/pdf-page.c5
-rw-r--r--source/pdf/pdf-parse.c3
-rw-r--r--source/pdf/pdf-pattern.c1
-rw-r--r--source/pdf/pdf-pkcs7.c3
-rw-r--r--source/pdf/pdf-portfolio.c3
-rw-r--r--source/pdf/pdf-repair.c4
-rw-r--r--source/pdf/pdf-resources.c1
-rw-r--r--source/pdf/pdf-run.c1
-rw-r--r--source/pdf/pdf-shade.c1
-rw-r--r--source/pdf/pdf-store.c3
-rw-r--r--source/pdf/pdf-stream.c3
-rw-r--r--source/pdf/pdf-type3.c1
-rw-r--r--source/pdf/pdf-unicode.c3
-rw-r--r--source/pdf/pdf-write.c8
-rw-r--r--source/pdf/pdf-xobject.c1
-rw-r--r--source/pdf/pdf-xref.c8
46 files changed, 138 insertions, 4 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index 1dc14ac2..10fd717b 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
#define TEXT_ANNOT_SIZE (25.0)
const char *pdf_string_from_annot_type(fz_context *ctx, fz_annot_type type)
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index f6b3223b..981e7a5d 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
static pdf_obj *
resolve_dest_rec(fz_context *ctx, pdf_document *doc, pdf_obj *dest, int depth)
{
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index 829b5917..e421b8dc 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -1,5 +1,9 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <float.h>
+#include <math.h>
+
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_ADVANCES_H
diff --git a/source/pdf/pdf-clean-file.c b/source/pdf/pdf-clean-file.c
index 8b8f96ba..f9311064 100644
--- a/source/pdf/pdf-clean-file.c
+++ b/source/pdf/pdf-clean-file.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
typedef struct globals_s
{
pdf_document *doc;
diff --git a/source/pdf/pdf-clean.c b/source/pdf/pdf-clean.c
index 680795a1..f74a3359 100644
--- a/source/pdf/pdf-clean.c
+++ b/source/pdf/pdf-clean.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
static void
diff --git a/source/pdf/pdf-cmap-load.c b/source/pdf/pdf-cmap-load.c
index d73749cd..76421e99 100644
--- a/source/pdf/pdf-cmap-load.c
+++ b/source/pdf/pdf-cmap-load.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
size_t
diff --git a/source/pdf/pdf-cmap-parse.c b/source/pdf/pdf-cmap-parse.c
index 6237629d..594d43c8 100644
--- a/source/pdf/pdf-cmap-parse.c
+++ b/source/pdf/pdf-cmap-parse.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
/*
* CMap parser
*/
diff --git a/source/pdf/pdf-cmap-table.c b/source/pdf/pdf-cmap-table.c
index 8b2a62c4..20e7758b 100644
--- a/source/pdf/pdf-cmap-table.c
+++ b/source/pdf/pdf-cmap-table.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
#ifdef NOCJK
#define CJK_CMAPS 0
#endif
diff --git a/source/pdf/pdf-cmap.c b/source/pdf/pdf-cmap.c
index 10e36ba2..755cc0a1 100644
--- a/source/pdf/pdf-cmap.c
+++ b/source/pdf/pdf-cmap.c
@@ -1,5 +1,9 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <assert.h>
+#include <string.h>
+
#undef CHECK_SPLAY
#undef DUMP_SPLAY
diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index eb120a5a..820ae713 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -1,7 +1,10 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include "../fitz/colorspace-imp.h"
+#include <string.h>
+
/* ICCBased */
static fz_colorspace *
diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c
index 0d78844b..9baefae5 100644
--- a/source/pdf/pdf-crypt.c
+++ b/source/pdf/pdf-crypt.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
enum
{
PDF_CRYPT_NONE,
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index ec247cec..bbfe06d2 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include <ft2build.h>
diff --git a/source/pdf/pdf-encoding.c b/source/pdf/pdf-encoding.c
index 25843c12..f23747dc 100644
--- a/source/pdf/pdf-encoding.c
+++ b/source/pdf/pdf-encoding.c
@@ -1,8 +1,12 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include "pdf-encodings.h"
#include "pdf-glyphlist.h"
+#include <string.h>
+#include <stdlib.h>
+
void
pdf_load_encoding(const char **estrings, char *encoding)
{
diff --git a/source/pdf/pdf-field.c b/source/pdf/pdf-field.c
index 00f4205a..4d36c4d6 100644
--- a/source/pdf/pdf-field.c
+++ b/source/pdf/pdf-field.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
pdf_obj *pdf_get_inheritable(fz_context *ctx, pdf_document *doc, pdf_obj *obj, pdf_obj *key)
{
pdf_obj *fobj = NULL;
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index 27679130..cee094b9 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -1,7 +1,10 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include "../fitz/font-imp.h"
+#include <assert.h>
+
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_ADVANCES_H
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index 02f0d87d..1eef8af6 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
/* Must be kept in sync with definitions in pdf_util.js */
enum
{
diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c
index 866a4f75..1c1b4454 100644
--- a/source/pdf/pdf-function.c
+++ b/source/pdf/pdf-function.c
@@ -1,5 +1,13 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+#include <math.h>
+#include <float.h>
+#include <limits.h>
+
+#define DIV_BY_ZERO(a, b, min, max) (((a) < 0) ^ ((b) < 0) ? (min) : (max))
+
enum
{
MAX_N = FZ_MAX_COLORS,
@@ -341,9 +349,9 @@ ps_run(fz_context *ctx, psobj *code, ps_stack *st, int pc)
{
case PS_OP_ABS:
if (ps_is_type(st, PS_INT))
- ps_push_int(st, abs(ps_pop_int(st)));
+ ps_push_int(st, fz_absi(ps_pop_int(st)));
else
- ps_push_real(st, fabsf(ps_pop_real(st)));
+ ps_push_real(st, fz_abs(ps_pop_real(st)));
break;
case PS_OP_ADD:
diff --git a/source/pdf/pdf-graft.c b/source/pdf/pdf-graft.c
index 04bb6b68..d2276ccc 100644
--- a/source/pdf/pdf-graft.c
+++ b/source/pdf/pdf-graft.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
struct pdf_graft_map_s
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index d2c610be..524284e8 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
static fz_image *pdf_load_jpx(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int forcemask);
static fz_image *
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c
index 8d2f6c57..ef06b312 100644
--- a/source/pdf/pdf-interpret.c
+++ b/source/pdf/pdf-interpret.c
@@ -1,5 +1,9 @@
+#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
+#include <string.h>
+
/* Maximum number of errors before aborting */
#define MAX_SYNTAX_ERRORS 100
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c
index 84938d30..e4bccc28 100644
--- a/source/pdf/pdf-js.c
+++ b/source/pdf/pdf-js.c
@@ -1,9 +1,13 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#if FZ_ENABLE_JS
#include "mujs.h"
+#include <stdarg.h>
+#include <string.h>
+
struct pdf_js_s
{
fz_context *ctx;
diff --git a/source/pdf/pdf-layer.c b/source/pdf/pdf-layer.c
index bf81a5c1..db0b0c1d 100644
--- a/source/pdf/pdf-layer.c
+++ b/source/pdf/pdf-layer.c
@@ -1,6 +1,9 @@
#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
+#include <string.h>
+
/*
Notes on OCGs etc.
diff --git a/source/pdf/pdf-lex.c b/source/pdf/pdf-lex.c
index 6a9ca906..ca4e42cf 100644
--- a/source/pdf/pdf-lex.c
+++ b/source/pdf/pdf-lex.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
#define IS_NUMBER \
'+':case'-':case'.':case'0':case'1':case'2':case'3':\
case'4':case'5':case'6':case'7':case'8':case'9'
diff --git a/source/pdf/pdf-metrics.c b/source/pdf/pdf-metrics.c
index 8a4b7d11..caf0a2a7 100644
--- a/source/pdf/pdf-metrics.c
+++ b/source/pdf/pdf-metrics.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <stdlib.h>
+
void
pdf_set_font_wmode(fz_context *ctx, pdf_font_desc *font, int wmode)
{
diff --git a/source/pdf/pdf-nametree.c b/source/pdf/pdf-nametree.c
index 178f1cea..71ee4ba7 100644
--- a/source/pdf/pdf-nametree.c
+++ b/source/pdf/pdf-nametree.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
static pdf_obj *
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index 86a204a6..3a903699 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -1,7 +1,12 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include "pdf-name-table.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
typedef enum pdf_objkind_e
{
PDF_INT = 'i',
diff --git a/source/pdf/pdf-op-buffer.c b/source/pdf/pdf-op-buffer.c
index e3becc13..6ae7f8fc 100644
--- a/source/pdf/pdf-op-buffer.c
+++ b/source/pdf/pdf-op-buffer.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
typedef struct pdf_output_processor_s pdf_output_processor;
diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c
index e3cbf4ce..731cabf2 100644
--- a/source/pdf/pdf-op-filter.c
+++ b/source/pdf/pdf-op-filter.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
typedef struct filter_gstate_s filter_gstate;
typedef enum
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index f1eac8d3..a71309d8 100644
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -1,5 +1,9 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+#include <math.h>
+
#define TILE
/*
diff --git a/source/pdf/pdf-outline.c b/source/pdf/pdf-outline.c
index 708f7087..7a774a13 100644
--- a/source/pdf/pdf-outline.c
+++ b/source/pdf/pdf-outline.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
static fz_outline *
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index f3860e52..39792c70 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -1,5 +1,10 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
int
pdf_count_pages(fz_context *ctx, pdf_document *doc)
{
diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c
index 7e67171b..fc1503bb 100644
--- a/source/pdf/pdf-parse.c
+++ b/source/pdf/pdf-parse.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
fz_rect *
pdf_to_rect(fz_context *ctx, pdf_obj *array, fz_rect *r)
{
diff --git a/source/pdf/pdf-pattern.c b/source/pdf/pdf-pattern.c
index 2091f400..0fb01d06 100644
--- a/source/pdf/pdf-pattern.c
+++ b/source/pdf/pdf-pattern.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
pdf_pattern *
diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c
index 3fac2c72..26db7909 100644
--- a/source/pdf/pdf-pkcs7.c
+++ b/source/pdf/pdf-pkcs7.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
#ifdef HAVE_LIBCRYPTO
/* Generated from resources/certs/AdobeCA.p7c */
diff --git a/source/pdf/pdf-portfolio.c b/source/pdf/pdf-portfolio.c
index 9235880c..761b7c51 100644
--- a/source/pdf/pdf-portfolio.c
+++ b/source/pdf/pdf-portfolio.c
@@ -1,6 +1,9 @@
#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
+#include <string.h>
+
/*
PDF Portfolio is just a sorted list of schema entries.
*/
diff --git a/source/pdf/pdf-repair.c b/source/pdf/pdf-repair.c
index b9ed4b8d..e8413b06 100644
--- a/source/pdf/pdf-repair.c
+++ b/source/pdf/pdf-repair.c
@@ -1,5 +1,9 @@
+#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
+#include <string.h>
+
/* Scan file for objects and reconstruct xref table */
/* Define in PDF 1.7 to be 8388607, but mupdf is more lenient. */
diff --git a/source/pdf/pdf-resources.c b/source/pdf/pdf-resources.c
index 002906f8..024beae3 100644
--- a/source/pdf/pdf-resources.c
+++ b/source/pdf/pdf-resources.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
static void
diff --git a/source/pdf/pdf-run.c b/source/pdf/pdf-run.c
index e00ad02b..4fa1071f 100644
--- a/source/pdf/pdf-run.c
+++ b/source/pdf/pdf-run.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
static void
diff --git a/source/pdf/pdf-shade.c b/source/pdf/pdf-shade.c
index 362c8c94..cc665fc7 100644
--- a/source/pdf/pdf-shade.c
+++ b/source/pdf/pdf-shade.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
/* FIXME: Remove this somehow */
diff --git a/source/pdf/pdf-store.c b/source/pdf/pdf-store.c
index c2d0669e..15828d79 100644
--- a/source/pdf/pdf-store.c
+++ b/source/pdf/pdf-store.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <assert.h>
+
static int
pdf_make_hash_key(fz_context *ctx, fz_store_hash *hash, void *key_)
{
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index d9b14405..871ea40e 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
/*
* Check if an object is a stream or not.
*/
diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c
index bc61b289..7432c4cd 100644
--- a/source/pdf/pdf-type3.c
+++ b/source/pdf/pdf-type3.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
#include "../fitz/font-imp.h"
diff --git a/source/pdf/pdf-unicode.c b/source/pdf/pdf-unicode.c
index fdff47ba..11b1aea8 100644
--- a/source/pdf/pdf-unicode.c
+++ b/source/pdf/pdf-unicode.c
@@ -1,5 +1,8 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
+#include <string.h>
+
/* Load or synthesize ToUnicode map for fonts */
static void
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 5477fa07..9a066430 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -1,7 +1,13 @@
+#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
#include <zlib.h>
+#include <assert.h>
+#include <string.h>
+
+#include <stdio.h> /* for debug printing */
/* #define DEBUG_LINEARIZATION */
/* #define DEBUG_HEAP_SORT */
/* #define DEBUG_WRITING */
@@ -2817,7 +2823,7 @@ pdf_parse_write_options(fz_context *ctx, pdf_write_options *opts, const char *ar
else if (fz_option_eq(val, "deduplicate"))
opts->do_garbage = 3;
else
- opts->do_garbage = atoi(val);
+ opts->do_garbage = fz_atoi(val);
}
return opts;
diff --git a/source/pdf/pdf-xobject.c b/source/pdf/pdf-xobject.c
index 9904570d..34d8edd8 100644
--- a/source/pdf/pdf-xobject.c
+++ b/source/pdf/pdf-xobject.c
@@ -1,3 +1,4 @@
+#include "mupdf/fitz.h"
#include "mupdf/pdf.h"
pdf_xobject *
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index e24da9a1..e5385ce8 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1,5 +1,11 @@
+#include "mupdf/fitz.h"
+#include "mupdf/pdf.h"
#include "pdf-imp.h"
-#include "mupdf/fitz/document.h"
+
+#include <assert.h>
+#include <string.h>
+#include <limits.h>
+#include <stdio.h>
#undef DEBUG_PROGESSIVE_ADVANCE