author | sandman <sandman> | 2002-05-23 23:51:52 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-05-23 23:51:52 (UTC) |
commit | 2f3bb7b07f833273d966d41813e68bfe8b9d8d76 (patch) (unidiff) | |
tree | 00beb1bd9e7f4ba79e22334a0d258269b28f4564 /noncore/unsupported/qpdf/xpdf/PDFDoc.cc | |
parent | 6e82b45dd416ceeba78765717b700e853c96a137 (diff) | |
download | opie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.zip opie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.tar.gz opie-2f3bb7b07f833273d966d41813e68bfe8b9d8d76.tar.bz2 |
Port to xpdf 1.01
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/PDFDoc.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/PDFDoc.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/PDFDoc.cc b/noncore/unsupported/qpdf/xpdf/PDFDoc.cc index 4bbe9b7..97dfa55 100644 --- a/noncore/unsupported/qpdf/xpdf/PDFDoc.cc +++ b/noncore/unsupported/qpdf/xpdf/PDFDoc.cc | |||
@@ -2,7 +2,7 @@ | |||
2 | // | 2 | // |
3 | // PDFDoc.cc | 3 | // PDFDoc.cc |
4 | // | 4 | // |
5 | // Copyright 1996 Derek B. Noonburg | 5 | // Copyright 1996-2002 Glyph & Cog, LLC |
6 | // | 6 | // |
7 | //======================================================================== | 7 | //======================================================================== |
8 | 8 | ||
@@ -24,6 +24,7 @@ | |||
24 | #include "Link.h" | 24 | #include "Link.h" |
25 | #include "OutputDev.h" | 25 | #include "OutputDev.h" |
26 | #include "Error.h" | 26 | #include "Error.h" |
27 | #include "ErrorCodes.h" | ||
27 | #include "Lexer.h" | 28 | #include "Lexer.h" |
28 | #include "Parser.h" | 29 | #include "Parser.h" |
29 | #include "PDFDoc.h" | 30 | #include "PDFDoc.h" |
@@ -43,6 +44,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, | |||
43 | GString *fileName2; | 44 | GString *fileName2; |
44 | 45 | ||
45 | ok = gFalse; | 46 | ok = gFalse; |
47 | errCode = errNone; | ||
46 | 48 | ||
47 | file = NULL; | 49 | file = NULL; |
48 | str = NULL; | 50 | str = NULL; |
@@ -57,6 +59,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, | |||
57 | #ifdef VMS | 59 | #ifdef VMS |
58 | if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) { | 60 | if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) { |
59 | error(-1, "Couldn't open file '%s'", fileName->getCString()); | 61 | error(-1, "Couldn't open file '%s'", fileName->getCString()); |
62 | errCode = errOpenFile; | ||
60 | return; | 63 | return; |
61 | } | 64 | } |
62 | #else | 65 | #else |
@@ -68,6 +71,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, | |||
68 | if (!(file = fopen(fileName2->getCString(), "rb"))) { | 71 | if (!(file = fopen(fileName2->getCString(), "rb"))) { |
69 | error(-1, "Couldn't open file '%s'", fileName->getCString()); | 72 | error(-1, "Couldn't open file '%s'", fileName->getCString()); |
70 | delete fileName2; | 73 | delete fileName2; |
74 | errCode = errOpenFile; | ||
71 | return; | 75 | return; |
72 | } | 76 | } |
73 | } | 77 | } |
@@ -77,7 +81,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, | |||
77 | 81 | ||
78 | // create stream | 82 | // create stream |
79 | obj.initNull(); | 83 | obj.initNull(); |
80 | str = new FileStream(file, 0, -1, &obj); | 84 | str = new FileStream(file, 0, gFalse, 0, &obj); |
81 | 85 | ||
82 | ok = setup(ownerPassword, userPassword); | 86 | ok = setup(ownerPassword, userPassword); |
83 | } | 87 | } |
@@ -85,6 +89,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, | |||
85 | PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword, | 89 | PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword, |
86 | GString *userPassword, GBool printCommandsA) { | 90 | GString *userPassword, GBool printCommandsA) { |
87 | ok = gFalse; | 91 | ok = gFalse; |
92 | errCode = errNone; | ||
88 | fileName = NULL; | 93 | fileName = NULL; |
89 | file = NULL; | 94 | file = NULL; |
90 | str = strA; | 95 | str = strA; |
@@ -103,6 +108,7 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { | |||
103 | xref = new XRef(str, ownerPassword, userPassword); | 108 | xref = new XRef(str, ownerPassword, userPassword); |
104 | if (!xref->isOk()) { | 109 | if (!xref->isOk()) { |
105 | error(-1, "Couldn't read xref table"); | 110 | error(-1, "Couldn't read xref table"); |
111 | errCode = xref->getErrorCode(); | ||
106 | return gFalse; | 112 | return gFalse; |
107 | } | 113 | } |
108 | 114 | ||
@@ -110,6 +116,7 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { | |||
110 | catalog = new Catalog(xref, printCommands); | 116 | catalog = new Catalog(xref, printCommands); |
111 | if (!catalog->isOk()) { | 117 | if (!catalog->isOk()) { |
112 | error(-1, "Couldn't read page catalog"); | 118 | error(-1, "Couldn't read page catalog"); |
119 | errCode = errBadCatalog; | ||
113 | return gFalse; | 120 | return gFalse; |
114 | } | 121 | } |
115 | 122 | ||
@@ -204,8 +211,9 @@ GBool PDFDoc::isLinearized() { | |||
204 | 211 | ||
205 | lin = gFalse; | 212 | lin = gFalse; |
206 | obj1.initNull(); | 213 | obj1.initNull(); |
207 | parser = new Parser(xref, new Lexer(xref, str->makeSubStream(str->getStart(), | 214 | parser = new Parser(xref, |
208 | -1, &obj1))); | 215 | new Lexer(xref, |
216 | str->makeSubStream(str->getStart(), gFalse, 0, &obj1))); | ||
209 | parser->getObj(&obj1); | 217 | parser->getObj(&obj1); |
210 | parser->getObj(&obj2); | 218 | parser->getObj(&obj2); |
211 | parser->getObj(&obj3); | 219 | parser->getObj(&obj3); |