summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/xpdf/PDFDoc.cc
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/PDFDoc.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/PDFDoc.cc16
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
@@ -3,5 +3,5 @@
// PDFDoc.cc
//
-// Copyright 1996 Derek B. Noonburg
+// Copyright 1996-2002 Glyph & Cog, LLC
//
//========================================================================
@@ -25,4 +25,5 @@
#include "OutputDev.h"
#include "Error.h"
+#include "ErrorCodes.h"
#include "Lexer.h"
#include "Parser.h"
@@ -44,4 +45,5 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
ok = gFalse;
+ errCode = errNone;
file = NULL;
@@ -58,4 +60,5 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) {
error(-1, "Couldn't open file '%s'", fileName->getCString());
+ errCode = errOpenFile;
return;
}
@@ -69,4 +72,5 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
error(-1, "Couldn't open file '%s'", fileName->getCString());
delete fileName2;
+ errCode = errOpenFile;
return;
}
@@ -78,5 +82,5 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
// create stream
obj.initNull();
- str = new FileStream(file, 0, -1, &obj);
+ str = new FileStream(file, 0, gFalse, 0, &obj);
ok = setup(ownerPassword, userPassword);
@@ -86,4 +90,5 @@ PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword,
GString *userPassword, GBool printCommandsA) {
ok = gFalse;
+ errCode = errNone;
fileName = NULL;
file = NULL;
@@ -104,4 +109,5 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) {
if (!xref->isOk()) {
error(-1, "Couldn't read xref table");
+ errCode = xref->getErrorCode();
return gFalse;
}
@@ -111,4 +117,5 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) {
if (!catalog->isOk()) {
error(-1, "Couldn't read page catalog");
+ errCode = errBadCatalog;
return gFalse;
}
@@ -205,6 +212,7 @@ GBool PDFDoc::isLinearized() {
lin = gFalse;
obj1.initNull();
- parser = new Parser(xref, new Lexer(xref, str->makeSubStream(str->getStart(),
- -1, &obj1)));
+ parser = new Parser(xref,
+ new Lexer(xref,
+ str->makeSubStream(str->getStart(), gFalse, 0, &obj1)));
parser->getObj(&obj1);
parser->getObj(&obj2);