summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi/fpdf_parser.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-22 13:46:40 -0800
committerLei Zhang <thestig@chromium.org>2015-12-22 13:46:40 -0800
commitbc75f1737f7eb8d45c5a2ebd3ad78203782c1642 (patch)
tree6f5d7ad99c6fa3013a9b24eaa5fda1352d64d065 /core/include/fpdfapi/fpdf_parser.h
parent291784e18f08e551ba2c86ccd72994b47f3023bd (diff)
downloadpdfium-bc75f1737f7eb8d45c5a2ebd3ad78203782c1642.tar.xz
Merge to XFA: Convert CPDF_Parser::m_CrossRef to a std::map.
This improvements memory usage in case PDFs have sparse object numbers. The map holds a struct that currently has only one member. The struct will contain more members as other internal data structures get converted. BUG=pdfium:111 TBR=weili@chromium.org Review URL: https://codereview.chromium.org/1539573003 . (cherry picked from commit f6dafc90ec1a0df8d618efc68c0223f0cdd80ffb) Review URL: https://codereview.chromium.org/1544913002 .
Diffstat (limited to 'core/include/fpdfapi/fpdf_parser.h')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index de0aa6196c..752df789da 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -394,10 +394,6 @@ class CPDF_Parser {
CFX_ByteString GetPassword() { return m_Password; }
- CPDF_SecurityHandler* GetSecurityHandler() {
- return m_pSecurityHandler.get();
- }
-
CPDF_CryptoHandler* GetCryptoHandler() {
return m_Syntax.m_pCryptoHandler.get();
}
@@ -405,44 +401,31 @@ class CPDF_Parser {
void SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler,
FX_BOOL bForced = FALSE);
- CFX_ByteString GetRecipient() { return m_bsRecipient; }
-
CPDF_Dictionary* GetTrailer() { return m_pTrailer; }
FX_FILESIZE GetLastXRefOffset() { return m_LastXRefOffset; }
CPDF_Document* GetDocument() { return m_pDocument; }
- CFX_ArrayTemplate<CPDF_Dictionary*>* GetOtherTrailers() {
- return &m_Trailers;
- }
-
FX_DWORD GetRootObjNum();
FX_DWORD GetInfoObjNum();
CPDF_Array* GetIDArray();
CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; }
- FX_BOOL IsEncrypted() { return GetEncryptDict() != NULL; }
-
CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList,
FX_DWORD objnum,
PARSE_CONTEXT* pContext = NULL);
- FX_DWORD GetLastObjNum();
+ FX_DWORD GetLastObjNum() const;
+ bool IsValidObjectNumber(FX_DWORD objnum) const;
FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
FX_FILESIZE GetObjectOffset(FX_DWORD objnum);
FX_FILESIZE GetObjectSize(FX_DWORD objnum);
- int GetObjectVersion(FX_DWORD objnum) { return m_ObjVersion[objnum]; }
-
void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size);
- FX_BOOL GetFileStreamOption() { return m_Syntax.m_bFileStream; }
-
- void SetFileStreamOption(FX_BOOL b) { m_Syntax.m_bFileStream = b; }
-
IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; }
int GetFileVersion() const { return m_FileVersion; }
@@ -523,13 +506,23 @@ class CPDF_Parser {
CFX_ByteString m_Password;
- CFX_FileSizeArray m_CrossRef;
+ struct ObjectInfo {
+ ObjectInfo() : pos(0) {}
+
+ FX_FILESIZE pos;
+// TODO(thestig): Use fields below in place of |m_V5Type| and |m_ObjVersion|
+#if 0
+ uint8_t type;
+ uint16_t gennum;
+#endif
+ };
+ std::map<FX_DWORD, ObjectInfo> m_ObjectInfo;
CFX_ByteArray m_V5Type;
+ CFX_WordArray m_ObjVersion;
CFX_FileSizeArray m_SortedOffset;
- CFX_WordArray m_ObjVersion;
CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers;
FX_BOOL m_bVersionUpdated;