summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-30 14:01:31 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-30 18:35:59 +0000
commitddb7016e69d99bb9355420b49a0ee864e2b7fe15 (patch)
tree03017f5f00da434b73d4ecc9e0823f9a609084fd
parent677329c9fa9f4f9e1a06f15e8d33d8a734cc5349 (diff)
downloadpdfium-ddb7016e69d99bb9355420b49a0ee864e2b7fe15.tar.xz
Move CFX files into fxcrt
This Cl moves more of the CFX classes defined in the xfa/ directory to the core/fxcrt directory and conditionally builds them. Change-Id: I811e6c6acd31dfbe75b49880be43661f78334013 Reviewed-on: https://pdfium-review.googlesource.com/3372 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--BUILD.gn24
-rw-r--r--core/fxcrt/cfx_chariter.cpp (renamed from xfa/fde/cfx_chariter.cpp)2
-rw-r--r--core/fxcrt/cfx_chariter.h (renamed from xfa/fde/cfx_chariter.h)8
-rw-r--r--core/fxcrt/cfx_checksumcontext.cpp (renamed from xfa/fxfa/cxfa_checksumcontext.cpp)20
-rw-r--r--core/fxcrt/cfx_checksumcontext.h (renamed from xfa/fxfa/cxfa_checksumcontext.h)14
-rw-r--r--core/fxcrt/cfx_wordbreak.cpp (renamed from xfa/fde/cfx_wordbreak.cpp)4
-rw-r--r--core/fxcrt/cfx_wordbreak.h (renamed from xfa/fde/cfx_wordbreak.h)6
-rw-r--r--core/fxcrt/ifx_chariter.h (renamed from xfa/fde/ifx_chariter.h)6
-rw-r--r--core/fxcrt/xml/cfx_saxcontext.h (renamed from xfa/fxfa/cxfa_saxcontext.h)14
-rw-r--r--core/fxcrt/xml/cfx_saxreader.cpp (renamed from xfa/fde/xml/cfx_saxreader.cpp)8
-rw-r--r--core/fxcrt/xml/cfx_saxreader.h (renamed from xfa/fde/xml/cfx_saxreader.h)16
-rw-r--r--core/fxcrt/xml/cfx_saxreaderhandler.cpp (renamed from xfa/fxfa/cxfa_saxreaderhandler.cpp)45
-rw-r--r--core/fxcrt/xml/cfx_saxreaderhandler.h49
-rw-r--r--fpdfsdk/fpdfsave.cpp4
-rw-r--r--testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc2
-rw-r--r--xfa/fde/cfde_txtedtbuf.h2
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp2
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp2
-rw-r--r--xfa/fde/cfde_txtedtpage.h2
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp4
-rw-r--r--xfa/fxfa/cxfa_ffdoc.h4
-rw-r--r--xfa/fxfa/cxfa_ffdochandler.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffdochandler.h2
-rw-r--r--xfa/fxfa/cxfa_saxreaderhandler.h49
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp4
26 files changed, 148 insertions, 149 deletions
diff --git a/BUILD.gn b/BUILD.gn
index cd3c724eb9..6018890fa4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -805,13 +805,25 @@ static_library("fxcrt") {
sources += [
"core/fxcrt/cfx_char.cpp",
"core/fxcrt/cfx_char.h",
+ "core/fxcrt/cfx_chariter.cpp",
+ "core/fxcrt/cfx_chariter.h",
+ "core/fxcrt/cfx_checksumcontext.cpp",
+ "core/fxcrt/cfx_checksumcontext.h",
"core/fxcrt/cfx_datetime.cpp",
"core/fxcrt/cfx_datetime.h",
"core/fxcrt/cfx_decimal.cpp",
"core/fxcrt/cfx_decimal.h",
+ "core/fxcrt/cfx_wordbreak.cpp",
+ "core/fxcrt/cfx_wordbreak.h",
"core/fxcrt/fx_arabic.cpp",
"core/fxcrt/fx_arabic.h",
+ "core/fxcrt/ifx_chariter.h",
"core/fxcrt/ifx_locale.h",
+ "core/fxcrt/xml/cfx_saxcontext.h",
+ "core/fxcrt/xml/cfx_saxreader.cpp",
+ "core/fxcrt/xml/cfx_saxreader.h",
+ "core/fxcrt/xml/cfx_saxreaderhandler.cpp",
+ "core/fxcrt/xml/cfx_saxreaderhandler.h",
]
}
}
@@ -1322,10 +1334,6 @@ if (pdf_enable_xfa) {
"xfa/fde/cfde_txtedttextset.h",
"xfa/fde/cfde_visualsetiterator.cpp",
"xfa/fde/cfde_visualsetiterator.h",
- "xfa/fde/cfx_chariter.cpp",
- "xfa/fde/cfx_chariter.h",
- "xfa/fde/cfx_wordbreak.cpp",
- "xfa/fde/cfx_wordbreak.h",
"xfa/fde/css/cfde_csscolorvalue.cpp",
"xfa/fde/css/cfde_csscolorvalue.h",
"xfa/fde/css/cfde_csscomputedstyle.cpp",
@@ -1368,11 +1376,8 @@ if (pdf_enable_xfa) {
"xfa/fde/ifde_txtedtdorecord.h",
"xfa/fde/ifde_txtedtengine.h",
"xfa/fde/ifde_txtedtpage.h",
- "xfa/fde/ifx_chariter.h",
"xfa/fde/tto/fde_textout.cpp",
"xfa/fde/tto/fde_textout.h",
- "xfa/fde/xml/cfx_saxreader.cpp",
- "xfa/fde/xml/cfx_saxreader.h",
"xfa/fde/xml/fde_xml.h",
"xfa/fde/xml/fde_xml_imp.cpp",
"xfa/fde/xml/fde_xml_imp.h",
@@ -1576,8 +1581,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/app/xfa_fwltheme.h",
"xfa/fxfa/app/xfa_textpiece.cpp",
"xfa/fxfa/app/xfa_textpiece.h",
- "xfa/fxfa/cxfa_checksumcontext.cpp",
- "xfa/fxfa/cxfa_checksumcontext.h",
"xfa/fxfa/cxfa_deffontmgr.cpp",
"xfa/fxfa/cxfa_deffontmgr.h",
"xfa/fxfa/cxfa_eventparam.cpp",
@@ -1602,9 +1605,6 @@ if (pdf_enable_xfa) {
"xfa/fxfa/cxfa_pdffontmgr.h",
"xfa/fxfa/cxfa_rendercontext.cpp",
"xfa/fxfa/cxfa_rendercontext.h",
- "xfa/fxfa/cxfa_saxcontext.h",
- "xfa/fxfa/cxfa_saxreaderhandler.cpp",
- "xfa/fxfa/cxfa_saxreaderhandler.h",
"xfa/fxfa/cxfa_widgetacc.cpp",
"xfa/fxfa/cxfa_widgetacc.h",
"xfa/fxfa/cxfa_widgetacciterator.cpp",
diff --git a/xfa/fde/cfx_chariter.cpp b/core/fxcrt/cfx_chariter.cpp
index ff5b0d9c3a..c14db2f322 100644
--- a/xfa/fde/cfx_chariter.cpp
+++ b/core/fxcrt/cfx_chariter.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/cfx_chariter.h"
+#include "core/fxcrt/cfx_chariter.h"
CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText)
: m_wsText(wsText), m_nIndex(0) {
diff --git a/xfa/fde/cfx_chariter.h b/core/fxcrt/cfx_chariter.h
index ab554b2716..00a725ef75 100644
--- a/xfa/fde/cfx_chariter.h
+++ b/core/fxcrt/cfx_chariter.h
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_CFX_CHARITER_H_
-#define XFA_FDE_CFX_CHARITER_H_
+#ifndef CORE_FXCRT_CFX_CHARITER_H_
+#define CORE_FXCRT_CFX_CHARITER_H_
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/ifx_chariter.h"
+#include "core/fxcrt/ifx_chariter.h"
class CFX_CharIter : public IFX_CharIter {
public:
@@ -28,4 +28,4 @@ class CFX_CharIter : public IFX_CharIter {
int32_t m_nIndex;
};
-#endif // XFA_FDE_CFX_CHARITER_H_
+#endif // CORE_FXCRT_CFX_CHARITER_H_
diff --git a/xfa/fxfa/cxfa_checksumcontext.cpp b/core/fxcrt/cfx_checksumcontext.cpp
index a59bdb16bf..994d18604a 100644
--- a/xfa/fxfa/cxfa_checksumcontext.cpp
+++ b/core/fxcrt/cfx_checksumcontext.cpp
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/cxfa_checksumcontext.h"
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fdrm/crypto/fx_crypt.h"
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fxfa/cxfa_saxreaderhandler.h"
namespace {
@@ -91,11 +91,11 @@ int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, char* pDst) {
} // namespace
-CXFA_ChecksumContext::CXFA_ChecksumContext() {}
+CFX_ChecksumContext::CFX_ChecksumContext() {}
-CXFA_ChecksumContext::~CXFA_ChecksumContext() {}
+CFX_ChecksumContext::~CFX_ChecksumContext() {}
-void CXFA_ChecksumContext::StartChecksum() {
+void CFX_ChecksumContext::StartChecksum() {
FinishChecksum();
m_pByteContext = pdfium::MakeUnique<CRYPT_sha1_context>();
CRYPT_SHA1Start(m_pByteContext.get());
@@ -103,7 +103,7 @@ void CXFA_ChecksumContext::StartChecksum() {
m_pSAXReader = pdfium::MakeUnique<CFX_SAXReader>();
}
-bool CXFA_ChecksumContext::UpdateChecksum(
+bool CFX_ChecksumContext::UpdateChecksum(
const CFX_RetainPtr<IFX_SeekableReadStream>& pSrcFile,
FX_FILESIZE offset,
size_t size) {
@@ -113,7 +113,7 @@ bool CXFA_ChecksumContext::UpdateChecksum(
if (size < 1)
size = pSrcFile->GetSize();
- CXFA_SAXReaderHandler handler(this);
+ CFX_SAXReaderHandler handler(this);
m_pSAXReader->SetHandler(&handler);
if (m_pSAXReader->StartParse(
pSrcFile, (uint32_t)offset, (uint32_t)size,
@@ -125,7 +125,7 @@ bool CXFA_ChecksumContext::UpdateChecksum(
return m_pSAXReader->ContinueParse(nullptr) > 99;
}
-void CXFA_ChecksumContext::FinishChecksum() {
+void CFX_ChecksumContext::FinishChecksum() {
m_pSAXReader.reset();
if (m_pByteContext) {
uint8_t digest[20];
@@ -139,11 +139,11 @@ void CXFA_ChecksumContext::FinishChecksum() {
}
}
-CFX_ByteString CXFA_ChecksumContext::GetChecksum() const {
+CFX_ByteString CFX_ChecksumContext::GetChecksum() const {
return m_bsChecksum;
}
-void CXFA_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
+void CFX_ChecksumContext::Update(const CFX_ByteStringC& bsText) {
if (!m_pByteContext)
return;
diff --git a/xfa/fxfa/cxfa_checksumcontext.h b/core/fxcrt/cfx_checksumcontext.h
index ca1b53007e..8869c540fb 100644
--- a/xfa/fxfa/cxfa_checksumcontext.h
+++ b/core/fxcrt/cfx_checksumcontext.h
@@ -4,18 +4,18 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_CXFA_CHECKSUMCONTEXT_H_
-#define XFA_FXFA_CXFA_CHECKSUMCONTEXT_H_
+#ifndef CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
+#define CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
#include <memory>
#include "core/fdrm/crypto/fx_crypt.h"
-#include "xfa/fde/xml/cfx_saxreader.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
-class CXFA_ChecksumContext {
+class CFX_ChecksumContext {
public:
- CXFA_ChecksumContext();
- ~CXFA_ChecksumContext();
+ CFX_ChecksumContext();
+ ~CFX_ChecksumContext();
void StartChecksum();
void Update(const CFX_ByteStringC& bsText);
@@ -31,4 +31,4 @@ class CXFA_ChecksumContext {
CFX_ByteString m_bsChecksum;
};
-#endif // XFA_FXFA_CXFA_CHECKSUMCONTEXT_H_
+#endif // CORE_FXCRT_CFX_CHECKSUMCONTEXT_H_
diff --git a/xfa/fde/cfx_wordbreak.cpp b/core/fxcrt/cfx_wordbreak.cpp
index 9ab3a9230a..c236f599f2 100644
--- a/xfa/fde/cfx_wordbreak.cpp
+++ b/core/fxcrt/cfx_wordbreak.cpp
@@ -4,12 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/cfx_wordbreak.h"
+#include "core/fxcrt/cfx_wordbreak.h"
#include <utility>
+#include "core/fxcrt/cfx_chariter.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/cfx_chariter.h"
namespace {
diff --git a/xfa/fde/cfx_wordbreak.h b/core/fxcrt/cfx_wordbreak.h
index 9df6eda1f5..4a7d925ec6 100644
--- a/xfa/fde/cfx_wordbreak.h
+++ b/core/fxcrt/cfx_wordbreak.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_CFX_WORDBREAK_H_
-#define XFA_FDE_CFX_WORDBREAK_H_
+#ifndef CORE_FXCRT_CFX_WORDBREAK_H_
+#define CORE_FXCRT_CFX_WORDBREAK_H_
#include <memory>
@@ -36,4 +36,4 @@ class CFX_WordBreak {
std::unique_ptr<IFX_CharIter> m_pCurIter;
};
-#endif // XFA_FDE_CFX_WORDBREAK_H_
+#endif // CORE_FXCRT_CFX_WORDBREAK_H_
diff --git a/xfa/fde/ifx_chariter.h b/core/fxcrt/ifx_chariter.h
index 0e4adc5d01..4435257cc9 100644
--- a/xfa/fde/ifx_chariter.h
+++ b/core/fxcrt/ifx_chariter.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_IFX_CHARITER_H_
-#define XFA_FDE_IFX_CHARITER_H_
+#ifndef CORE_FXCRT_IFX_CHARITER_H_
+#define CORE_FXCRT_IFX_CHARITER_H_
#include "core/fxcrt/fx_system.h"
@@ -21,4 +21,4 @@ class IFX_CharIter {
virtual IFX_CharIter* Clone() = 0;
};
-#endif // XFA_FDE_IFX_CHARITER_H_
+#endif // CORE_FXCRT_IFX_CHARITER_H_
diff --git a/xfa/fxfa/cxfa_saxcontext.h b/core/fxcrt/xml/cfx_saxcontext.h
index 47e7b78423..7afebed98d 100644
--- a/xfa/fxfa/cxfa_saxcontext.h
+++ b/core/fxcrt/xml/cfx_saxcontext.h
@@ -4,16 +4,20 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_CXFA_SAXCONTEXT_H_
-#define XFA_FXFA_CXFA_SAXCONTEXT_H_
+#ifndef CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
+#define CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
-class CXFA_SAXContext {
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+class CFX_SAXContext {
public:
- CXFA_SAXContext() : m_eNode(CFX_SAXItem::Type::Unknown) {}
+ CFX_SAXContext() : m_eNode(CFX_SAXItem::Type::Unknown) {}
CFX_ByteTextBuf m_TextBuf;
CFX_ByteString m_bsTagName;
CFX_SAXItem::Type m_eNode;
};
-#endif // XFA_FXFA_CXFA_SAXCONTEXT_H_
+#endif // CORE_FXCRT_XML_CFX_SAXCONTEXT_H_
diff --git a/xfa/fde/xml/cfx_saxreader.cpp b/core/fxcrt/xml/cfx_saxreader.cpp
index 50f65731f7..287eaaa5b8 100644
--- a/xfa/fde/xml/cfx_saxreader.cpp
+++ b/core/fxcrt/xml/cfx_saxreader.cpp
@@ -4,14 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfx_saxreader.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
#include <algorithm>
#include <utility>
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fxfa/cxfa_saxreaderhandler.h"
enum class CFX_SaxMode {
Text = 0,
@@ -728,7 +728,3 @@ void CFX_SAXReader::SkipCurrentNode() {
pItem->m_bSkip = true;
}
-
-void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) {
- m_pHandler = pHandler;
-}
diff --git a/xfa/fde/xml/cfx_saxreader.h b/core/fxcrt/xml/cfx_saxreader.h
index a5973c699e..af3c26f94a 100644
--- a/xfa/fde/xml/cfx_saxreader.h
+++ b/core/fxcrt/xml/cfx_saxreader.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFX_SAXREADER_H_
-#define XFA_FDE_XML_CFX_SAXREADER_H_
+#ifndef CORE_FXCRT_XML_CFX_SAXREADER_H_
+#define CORE_FXCRT_XML_CFX_SAXREADER_H_
#include <memory>
#include <stack>
@@ -13,8 +13,8 @@
#include "core/fxcrt/fx_basic.h"
class CFX_SAXCommentContext;
-class CXFA_SAXContext;
-class CXFA_SAXReaderHandler;
+class CFX_SAXContext;
+class CFX_SAXReaderHandler;
enum class CFX_SaxMode;
class CFX_SAXItem {
@@ -32,7 +32,7 @@ class CFX_SAXItem {
explicit CFX_SAXItem(uint32_t id)
: m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(false) {}
- CXFA_SAXContext* m_pNode;
+ CFX_SAXContext* m_pNode;
Type m_eNode;
const uint32_t m_dwID;
bool m_bSkip;
@@ -79,7 +79,7 @@ class CFX_SAXReader {
uint32_t dwParseMode = 0);
int32_t ContinueParse(IFX_Pause* pPause = nullptr);
void SkipCurrentNode();
- void SetHandler(CXFA_SAXReaderHandler* pHandler);
+ void SetHandler(CFX_SAXReaderHandler* pHandler) { m_pHandler = pHandler; }
void AppendData(uint8_t ch);
void AppendName(uint8_t ch);
void ParseText();
@@ -117,7 +117,7 @@ class CFX_SAXReader {
void ParseChar(uint8_t ch);
CFX_SAXFile m_File;
- CXFA_SAXReaderHandler* m_pHandler;
+ CFX_SAXReaderHandler* m_pHandler;
int32_t m_iState;
std::stack<std::unique_ptr<CFX_SAXItem>> m_Stack;
uint32_t m_dwItemID;
@@ -141,4 +141,4 @@ class CFX_SAXReader {
std::unique_ptr<CFX_SAXCommentContext> m_pCommentContext;
};
-#endif // XFA_FDE_XML_CFX_SAXREADER_H_
+#endif // CORE_FXCRT_XML_CFX_SAXREADER_H_
diff --git a/xfa/fxfa/cxfa_saxreaderhandler.cpp b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
index c09bdf5b4c..e7b6cd186c 100644
--- a/xfa/fxfa/cxfa_saxreaderhandler.cpp
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.cpp
@@ -4,18 +4,18 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/cxfa_saxreaderhandler.h"
+#include "core/fxcrt/xml/cfx_saxreaderhandler.h"
-#include "xfa/fxfa/cxfa_checksumcontext.h"
+#include "core/fxcrt/cfx_checksumcontext.h"
-CXFA_SAXReaderHandler::CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext)
+CFX_SAXReaderHandler::CFX_SAXReaderHandler(CFX_ChecksumContext* pContext)
: m_pContext(pContext) {
ASSERT(m_pContext);
}
-CXFA_SAXReaderHandler::~CXFA_SAXReaderHandler() {}
+CFX_SAXReaderHandler::~CFX_SAXReaderHandler() {}
-CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter(
+CFX_SAXContext* CFX_SAXReaderHandler::OnTagEnter(
const CFX_ByteStringC& bsTagName,
CFX_SAXItem::Type eType,
uint32_t dwStartPos) {
@@ -36,15 +36,15 @@ CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter(
return &m_SAXContext;
}
-void CXFA_SAXReaderHandler::OnTagAttribute(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue) {
+void CFX_SAXReaderHandler::OnTagAttribute(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue) {
if (!pTag)
return;
pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\"";
}
-void CXFA_SAXReaderHandler::OnTagBreak(CXFA_SAXContext* pTag) {
+void CFX_SAXReaderHandler::OnTagBreak(CFX_SAXContext* pTag) {
if (!pTag)
return;
@@ -52,10 +52,10 @@ void CXFA_SAXReaderHandler::OnTagBreak(CXFA_SAXContext* pTag) {
UpdateChecksum(false);
}
-void CXFA_SAXReaderHandler::OnTagData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
+void CFX_SAXReaderHandler::OnTagData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos) {
if (!pTag)
return;
@@ -68,8 +68,7 @@ void CXFA_SAXReaderHandler::OnTagData(CXFA_SAXContext* pTag,
textBuf << "]]>";
}
-void CXFA_SAXReaderHandler::OnTagClose(CXFA_SAXContext* pTag,
- uint32_t dwEndPos) {
+void CFX_SAXReaderHandler::OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos) {
if (!pTag)
return;
@@ -82,9 +81,9 @@ void CXFA_SAXReaderHandler::OnTagClose(CXFA_SAXContext* pTag,
UpdateChecksum(false);
}
-void CXFA_SAXReaderHandler::OnTagEnd(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos) {
+void CFX_SAXReaderHandler::OnTagEnd(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos) {
if (!pTag)
return;
@@ -92,10 +91,10 @@ void CXFA_SAXReaderHandler::OnTagEnd(CXFA_SAXContext* pTag,
UpdateChecksum(false);
}
-void CXFA_SAXReaderHandler::OnTargetData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos) {
+void CFX_SAXReaderHandler::OnTargetData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos) {
if (!pTag && eType != CFX_SAXItem::Type::Comment)
return;
@@ -107,7 +106,7 @@ void CXFA_SAXReaderHandler::OnTargetData(CXFA_SAXContext* pTag,
}
}
-void CXFA_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
+void CFX_SAXReaderHandler::UpdateChecksum(bool bCheckSpace) {
int32_t iLength = m_SAXContext.m_TextBuf.GetLength();
if (iLength < 1)
return;
diff --git a/core/fxcrt/xml/cfx_saxreaderhandler.h b/core/fxcrt/xml/cfx_saxreaderhandler.h
new file mode 100644
index 0000000000..bfedf03846
--- /dev/null
+++ b/core/fxcrt/xml/cfx_saxreaderhandler.h
@@ -0,0 +1,49 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
+#define CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cfx_saxcontext.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
+
+class CFX_ChecksumContext;
+
+class CFX_SAXReaderHandler {
+ public:
+ explicit CFX_SAXReaderHandler(CFX_ChecksumContext* pContext);
+ ~CFX_SAXReaderHandler();
+
+ CFX_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
+ CFX_SAXItem::Type eType,
+ uint32_t dwStartPos);
+ void OnTagAttribute(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsAttri,
+ const CFX_ByteStringC& bsValue);
+ void OnTagBreak(CFX_SAXContext* pTag);
+ void OnTagData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+ void OnTagClose(CFX_SAXContext* pTag, uint32_t dwEndPos);
+ void OnTagEnd(CFX_SAXContext* pTag,
+ const CFX_ByteStringC& bsTagName,
+ uint32_t dwEndPos);
+
+ void OnTargetData(CFX_SAXContext* pTag,
+ CFX_SAXItem::Type eType,
+ const CFX_ByteStringC& bsData,
+ uint32_t dwStartPos);
+
+ private:
+ void UpdateChecksum(bool bCheckSpace);
+
+ CFX_ChecksumContext* m_pContext;
+ CFX_SAXContext m_SAXContext;
+};
+
+#endif // CORE_FXCRT_XML_CFX_SAXREADERHANDLER_H_
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index fe764f5e1f..1d076ccdad 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -21,10 +21,10 @@
#include "public/fpdf_edit.h"
#ifdef PDF_ENABLE_XFA
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h"
#include "public/fpdf_formfill.h"
-#include "xfa/fxfa/cxfa_checksumcontext.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
@@ -127,7 +127,7 @@ bool SaveXFADocumentData(
else if (pPDFObj->GetString() == "template")
iTemplate = i + 1;
}
- std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext);
+ std::unique_ptr<CFX_ChecksumContext> pChecksum(new CFX_ChecksumContext);
pChecksum->StartChecksum();
// template
diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index 3be8e014ee..00b55cdbd4 100644
--- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -5,7 +5,7 @@
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fde/xml/cfx_saxreader.h"
+#include "core/fxcrt/xml/cfx_saxreader.h"
#include "xfa/fgas/crt/ifgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h
index 6a20ae0de1..650d375bf8 100644
--- a/xfa/fde/cfde_txtedtbuf.h
+++ b/xfa/fde/cfde_txtedtbuf.h
@@ -13,7 +13,7 @@
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fde/ifx_chariter.h"
+#include "core/fxcrt/ifx_chariter.h"
class IFX_Pause;
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index d4acd06ec5..bdd36aa218 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -9,13 +9,13 @@
#include <algorithm>
#include <utility>
+#include "core/fxcrt/ifx_chariter.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtdorecord_deleterange.h"
#include "xfa/fde/cfde_txtedtdorecord_insert.h"
#include "xfa/fde/cfde_txtedtpage.h"
#include "xfa/fde/cfde_txtedtparag.h"
-#include "xfa/fde/ifx_chariter.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
#include "xfa/fwl/cfwl_edit.h"
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 3a1c9ab88f..ef16939116 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -8,13 +8,13 @@
#include <algorithm>
+#include "core/fxcrt/cfx_wordbreak.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtparag.h"
#include "xfa/fde/cfde_txtedttextset.h"
-#include "xfa/fde/cfx_wordbreak.h"
#include "xfa/fde/ifde_txtedtengine.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h
index 699a9086ce..beebdad2af 100644
--- a/xfa/fde/cfde_txtedtpage.h
+++ b/xfa/fde/cfde_txtedtpage.h
@@ -11,8 +11,8 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/ifx_chariter.h"
#include "xfa/fde/ifde_visualset.h"
-#include "xfa/fde/ifx_chariter.h"
class CFDE_TxtEdtEngine;
class CFDE_TxtEdtParag;
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index 19b3f84484..ceff448f2c 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -9,12 +9,12 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/ifx_chariter.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fde/ifx_chariter.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
CFDE_TxtEdtParag::CFDE_TxtEdtParag(CFDE_TxtEdtEngine* pEngine)
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 43551008db..b5036926aa 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -14,13 +14,13 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_nametree.h"
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_memory.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
-#include "xfa/fxfa/cxfa_checksumcontext.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -403,7 +403,7 @@ CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage(
bool CXFA_FFDoc::SavePackage(
XFA_HashCode code,
const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
- CXFA_ChecksumContext* pCSContext) {
+ CFX_ChecksumContext* pCSContext) {
CXFA_Document* doc = m_pDocumentParser->GetDocument();
std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc));
CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
diff --git a/xfa/fxfa/cxfa_ffdoc.h b/xfa/fxfa/cxfa_ffdoc.h
index 80dafba029..0bba956f14 100644
--- a/xfa/fxfa/cxfa_ffdoc.h
+++ b/xfa/fxfa/cxfa_ffdoc.h
@@ -14,7 +14,7 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_document_parser.h"
-class CXFA_ChecksumContext;
+class CFX_ChecksumContext;
class CXFA_FFApp;
class CXFA_FFNotify;
class CXFA_FFDocView;
@@ -73,7 +73,7 @@ class CXFA_FFDoc {
bool SavePackage(XFA_HashCode code,
const CFX_RetainPtr<IFX_SeekableWriteStream>& pFile,
- CXFA_ChecksumContext* pCSContext);
+ CFX_ChecksumContext* pCSContext);
bool ImportData(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream,
bool bXDP = true);
diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp
index f926638406..b0a84fa29a 100644
--- a/xfa/fxfa/cxfa_ffdochandler.cpp
+++ b/xfa/fxfa/cxfa_ffdochandler.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/cxfa_ffdochandler.h"
-#include "xfa/fxfa/cxfa_checksumcontext.h"
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
diff --git a/xfa/fxfa/cxfa_ffdochandler.h b/xfa/fxfa/cxfa_ffdochandler.h
index b54c36c1d7..45b2ee07e1 100644
--- a/xfa/fxfa/cxfa_ffdochandler.h
+++ b/xfa/fxfa/cxfa_ffdochandler.h
@@ -9,7 +9,7 @@
#include "xfa/fxfa/fxfa.h"
-class CXFA_ChecksumContext;
+class CFX_ChecksumContext;
class CXFA_FFDocHandler {
public:
diff --git a/xfa/fxfa/cxfa_saxreaderhandler.h b/xfa/fxfa/cxfa_saxreaderhandler.h
deleted file mode 100644
index 3ad69322bb..0000000000
--- a/xfa/fxfa/cxfa_saxreaderhandler.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXFA_CXFA_SAXREADERHANDLER_H_
-#define XFA_FXFA_CXFA_SAXREADERHANDLER_H_
-
-#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfx_saxreader.h"
-#include "xfa/fxfa/cxfa_saxcontext.h"
-
-class CXFA_ChecksumContext;
-
-class CXFA_SAXReaderHandler {
- public:
- explicit CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext);
- ~CXFA_SAXReaderHandler();
-
- CXFA_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName,
- CFX_SAXItem::Type eType,
- uint32_t dwStartPos);
- void OnTagAttribute(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsAttri,
- const CFX_ByteStringC& bsValue);
- void OnTagBreak(CXFA_SAXContext* pTag);
- void OnTagData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
- void OnTagClose(CXFA_SAXContext* pTag, uint32_t dwEndPos);
- void OnTagEnd(CXFA_SAXContext* pTag,
- const CFX_ByteStringC& bsTagName,
- uint32_t dwEndPos);
-
- void OnTargetData(CXFA_SAXContext* pTag,
- CFX_SAXItem::Type eType,
- const CFX_ByteStringC& bsData,
- uint32_t dwStartPos);
-
- private:
- void UpdateChecksum(bool bCheckSpace);
-
- CXFA_ChecksumContext* m_pContext;
- CXFA_SAXContext m_SAXContext;
-};
-
-#endif // XFA_FXFA_CXFA_SAXREADERHANDLER_H_
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index a4a785c98e..949f7864ea 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -8,10 +8,10 @@
#include <utility>
+#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fxfa/cxfa_checksumcontext.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -661,7 +661,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
m_pXMLParser->m_dwCheckStatus != 0x03) {
return nullptr;
}
- std::unique_ptr<CXFA_ChecksumContext> pChecksum(new CXFA_ChecksumContext);
+ std::unique_ptr<CFX_ChecksumContext> pChecksum(new CFX_ChecksumContext);
pChecksum->StartChecksum();
pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0],
m_pXMLParser->m_nSize[0]);