Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/XRef.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/XRef.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/XRef.h b/noncore/unsupported/qpdf/xpdf/XRef.h index a44c495..7876fa6 100644 --- a/noncore/unsupported/qpdf/xpdf/XRef.h +++ b/noncore/unsupported/qpdf/xpdf/XRef.h | |||
@@ -2,7 +2,7 @@ | |||
2 | // | 2 | // |
3 | // XRef.h | 3 | // XRef.h |
4 | // | 4 | // |
5 | // Copyright 1996 Derek B. Noonburg | 5 | // Copyright 1996-2002 Glyph & Cog, LLC |
6 | // | 6 | // |
7 | //======================================================================== | 7 | //======================================================================== |
8 | 8 | ||
@@ -24,7 +24,7 @@ class Stream; | |||
24 | //------------------------------------------------------------------------ | 24 | //------------------------------------------------------------------------ |
25 | 25 | ||
26 | struct XRefEntry { | 26 | struct XRefEntry { |
27 | int offset; | 27 | Guint offset; |
28 | int gen; | 28 | int gen; |
29 | GBool used; | 29 | GBool used; |
30 | }; | 30 | }; |
@@ -41,6 +41,9 @@ public: | |||
41 | // Is xref table valid? | 41 | // Is xref table valid? |
42 | GBool isOk() { return ok; } | 42 | GBool isOk() { return ok; } |
43 | 43 | ||
44 | // Get the error code (if isOk() returns false). | ||
45 | int getErrorCode() { return errCode; } | ||
46 | |||
44 | // Is the file encrypted? | 47 | // Is the file encrypted? |
45 | #ifndef NO_DECRYPTION | 48 | #ifndef NO_DECRYPTION |
46 | GBool isEncrypted() { return encrypted; } | 49 | GBool isEncrypted() { return encrypted; } |
@@ -68,28 +71,29 @@ public: | |||
68 | int getNumObjects() { return size; } | 71 | int getNumObjects() { return size; } |
69 | 72 | ||
70 | // Return the offset of the last xref table. | 73 | // Return the offset of the last xref table. |
71 | int getLastXRefPos() { return lastXRefPos; } | 74 | Guint getLastXRefPos() { return lastXRefPos; } |
72 | 75 | ||
73 | // Return the catalog object reference. | 76 | // Return the catalog object reference. |
74 | int getRootNum() { return rootNum; } | 77 | int getRootNum() { return rootNum; } |
75 | int getRootGen() { return rootGen; } | 78 | int getRootGen() { return rootGen; } |
76 | 79 | ||
77 | // Get end position for a stream in a damaged file. | 80 | // Get end position for a stream in a damaged file. |
78 | // Returns -1 if unknown or file is not damaged. | 81 | // Returns false if unknown or file is not damaged. |
79 | int getStreamEnd(int streamStart); | 82 | GBool getStreamEnd(Guint streamStart, Guint *streamEnd); |
80 | 83 | ||
81 | private: | 84 | private: |
82 | 85 | ||
83 | BaseStream *str; // input stream | 86 | BaseStream *str; // input stream |
84 | int start; // offset in file (to allow for garbage | 87 | Guint start; // offset in file (to allow for garbage |
85 | // at beginning of file) | 88 | // at beginning of file) |
86 | XRefEntry *entries; // xref entries | 89 | XRefEntry *entries; // xref entries |
87 | int size; // size of <entries> array | 90 | int size; // size of <entries> array |
88 | int rootNum, rootGen; // catalog dict | 91 | int rootNum, rootGen; // catalog dict |
89 | GBool ok; // true if xref table is valid | 92 | GBool ok; // true if xref table is valid |
93 | int errCode; // error code (if <ok> is false) | ||
90 | Object trailerDict; // trailer dictionary | 94 | Object trailerDict; // trailer dictionary |
91 | int lastXRefPos; // offset of last xref table | 95 | Guint lastXRefPos; // offset of last xref table |
92 | int *streamEnds; // 'endstream' positions - only used in | 96 | Guint *streamEnds; // 'endstream' positions - only used in |
93 | // damaged files | 97 | // damaged files |
94 | int streamEndsLen; // number of valid entries in streamEnds | 98 | int streamEndsLen; // number of valid entries in streamEnds |
95 | #ifndef NO_DECRYPTION | 99 | #ifndef NO_DECRYPTION |
@@ -102,10 +106,11 @@ private: | |||
102 | GBool ownerPasswordOk;// true if owner password is correct | 106 | GBool ownerPasswordOk;// true if owner password is correct |
103 | #endif | 107 | #endif |
104 | 108 | ||
105 | int readTrailer(); | 109 | Guint readTrailer(); |
106 | GBool readXRef(int *pos); | 110 | GBool readXRef(Guint *pos); |
107 | GBool constructXRef(); | 111 | GBool constructXRef(); |
108 | GBool checkEncrypted(GString *ownerPassword, GString *userPassword); | 112 | GBool checkEncrypted(GString *ownerPassword, GString *userPassword); |
113 | Guint strToUnsigned(char *s); | ||
109 | }; | 114 | }; |
110 | 115 | ||
111 | #endif | 116 | #endif |