summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h20
-rw-r--r--core/include/fpdfapi/fpdf_parser.h71
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp2
4 files changed, 38 insertions, 60 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 69f344cf9c..0ad641a1e4 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -9,21 +9,22 @@
#include "../fxcrt/fx_ext.h"
+class CPDF_Array;
+class CPDF_Boolean;
+class CPDF_CryptoHandler;
+class CPDF_Dictionary;
class CPDF_Document;
class CPDF_IndirectObjects;
class CPDF_Null;
-class CPDF_Boolean;
class CPDF_Number;
-class CPDF_String;
+class CPDF_Parser;
+class CPDF_Reference;
class CPDF_Stream;
class CPDF_StreamAcc;
class CPDF_StreamFilter;
-class CPDF_Array;
-class CPDF_Dictionary;
-class CPDF_Reference;
-class IPDF_DocParser;
+class CPDF_String;
class IFX_FileRead;
-class CPDF_CryptoHandler;
+
#define PDFOBJ_INVALID 0
#define PDFOBJ_BOOLEAN 1
#define PDFOBJ_NUMBER 2
@@ -34,6 +35,7 @@ class CPDF_CryptoHandler;
#define PDFOBJ_STREAM 7
#define PDFOBJ_NULL 8
#define PDFOBJ_REFERENCE 9
+
typedef IFX_FileStream* (*FPDF_LPFCloneStreamCallback)(CPDF_Stream *pStream, FX_LPVOID pUserData);
class CPDF_Object
{
@@ -709,7 +711,7 @@ class CPDF_IndirectObjects
{
public:
- CPDF_IndirectObjects(IPDF_DocParser* pParser);
+ CPDF_IndirectObjects(CPDF_Parser* pParser);
~CPDF_IndirectObjects();
@@ -738,7 +740,7 @@ protected:
CFX_MapPtrToPtr m_IndirectObjs;
- IPDF_DocParser* m_pParser;
+ CPDF_Parser* m_pParser;
FX_DWORD m_LastObjNum;
};
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 0dc9ca64a3..34568e79ca 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -11,7 +11,6 @@
#include "fpdf_objects.h"
class CPDF_Document;
-class IPDF_DocParser;
class CPDF_Parser;
class CPDF_SecurityHandler;
class CPDF_StandardSecurityHandler;
@@ -61,14 +60,12 @@ public:
class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects
{
public:
-
- CPDF_Document(IPDF_DocParser* pParser);
-
CPDF_Document();
+ explicit CPDF_Document(CPDF_Parser* pParser);
~CPDF_Document();
- IPDF_DocParser* GetParser() const
+ CPDF_Parser* GetParser() const
{
return m_pParser;
}
@@ -370,33 +367,6 @@ struct PARSE_CONTEXT {
FX_FILESIZE m_DataEnd;
};
-class IPDF_DocParser
-{
-public:
- virtual ~IPDF_DocParser() { }
- virtual FX_DWORD GetRootObjNum() = 0;
-
- virtual FX_DWORD GetInfoObjNum() = 0;
-
- virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) = 0;
-
- virtual FX_DWORD GetLastObjNum() = 0;
-
- virtual CPDF_Array* GetIDArray() = 0;
-
- virtual CPDF_Dictionary* GetEncryptDict() = 0;
-
- FX_BOOL IsEncrypted()
- {
- return GetEncryptDict() != NULL;
- }
-
- virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) = 0;
-
- virtual FX_BOOL IsOwner() = 0;
-
- virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) = 0;
-};
#define PDFPARSE_ERROR_SUCCESS 0
#define PDFPARSE_ERROR_FILE 1
@@ -404,24 +374,22 @@ public:
#define PDFPARSE_ERROR_PASSWORD 3
#define PDFPARSE_ERROR_HANDLER 4
#define PDFPARSE_ERROR_CERT 5
-class CPDF_Parser FX_FINAL : public IPDF_DocParser
+
+class CPDF_Parser
{
public:
-
CPDF_Parser();
- ~CPDF_Parser() override;
+ ~CPDF_Parser();
FX_DWORD StartParse(FX_LPCSTR filename, FX_BOOL bReParse = FALSE);
-
FX_DWORD StartParse(FX_LPCWSTR filename, FX_BOOL bReParse = FALSE);
-
FX_DWORD StartParse(IFX_FileRead* pFile, FX_BOOL bReParse = FALSE, FX_BOOL bOwnFileRead = TRUE);
void CloseParser(FX_BOOL bReParse = FALSE);
- virtual FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE) FX_OVERRIDE;
+ FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE);
- virtual FX_BOOL IsOwner() FX_OVERRIDE;
+ FX_BOOL IsOwner();
void SetPassword(const FX_CHAR* password)
{
@@ -464,21 +432,30 @@ public:
{
return m_pDocument;
}
- CFX_ArrayTemplate<CPDF_Dictionary *> * GetOtherTrailers()
+
+ CFX_ArrayTemplate<CPDF_Dictionary*>* GetOtherTrailers()
{
return &m_Trailers;
}
- virtual FX_DWORD GetRootObjNum() FX_OVERRIDE;
- virtual FX_DWORD GetInfoObjNum() FX_OVERRIDE;
- virtual CPDF_Array* GetIDArray() FX_OVERRIDE;
- virtual CPDF_Dictionary* GetEncryptDict() FX_OVERRIDE
+ FX_DWORD GetRootObjNum();
+ FX_DWORD GetInfoObjNum() ;
+ CPDF_Array* GetIDArray() ;
+
+ CPDF_Dictionary* GetEncryptDict()
{
return m_pEncryptDict;
}
- virtual CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) FX_OVERRIDE;
- virtual FX_DWORD GetLastObjNum() FX_OVERRIDE;
- virtual FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) FX_OVERRIDE;
+
+ FX_BOOL IsEncrypted()
+ {
+ return GetEncryptDict() != NULL;
+ }
+
+
+ CPDF_Object* ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, PARSE_CONTEXT* pContext = NULL) ;
+ FX_DWORD GetLastObjNum();
+ FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
FX_FILESIZE GetObjectOffset(FX_DWORD objnum);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index c3e35d882d..fb43c64a1a 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -6,9 +6,8 @@
#include "../../../include/fpdfapi/fpdf_parser.h"
#include "../../../include/fpdfapi/fpdf_module.h"
-extern FX_LPVOID PDFPreviewInitCache(CPDF_Document* pDoc);
-extern void PDFPreviewClearCache(FX_LPVOID pCache);
-CPDF_Document::CPDF_Document(IPDF_DocParser* pParser) : CPDF_IndirectObjects(pParser)
+
+CPDF_Document::CPDF_Document(CPDF_Parser* pParser) : CPDF_IndirectObjects(pParser)
{
ASSERT(pParser != NULL);
m_pRootDict = NULL;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 341be13d44..0e176066ef 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -1173,7 +1173,7 @@ void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum)
m_pObjList = pDoc;
m_RefObjNum = objnum;
}
-CPDF_IndirectObjects::CPDF_IndirectObjects(IPDF_DocParser* pParser)
+CPDF_IndirectObjects::CPDF_IndirectObjects(CPDF_Parser* pParser)
{
m_pParser = pParser;
m_IndirectObjs.InitHashTable(1013);