summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_dataexporter.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-03 16:46:21 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-03 21:05:39 +0000
commitac35589d5d1a593497cf28d91ab6a236f25833c3 (patch)
treefa68e190e5878156659dd0e3c649d83c912dee97 /xfa/fxfa/parser/cxfa_dataexporter.cpp
parent6da8ac5053e9ebf7c4ce0d9d67b0443d3f8f6084 (diff)
downloadpdfium-ac35589d5d1a593497cf28d91ab6a236f25833c3.tar.xz
Split the FDE XML file into indiviual class files.
This Cl splits the fde_xml_int file apart into individual class files. Includes are fixed as needed. fde_xml.h is also removed and the needed defines moved to more appropiate places. Change-Id: I29774dabc4d0fb2d5092fcbbe7853f03401b6ec7 Reviewed-on: https://pdfium-review.googlesource.com/3616 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_dataexporter.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index f9553c413f..fda29c2201 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -10,7 +10,9 @@
#include "core/fxcrt/fx_basic.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/fde_xml_imp.h"
+#include "xfa/fde/xml/cfde_xmldoc.h"
+#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -46,12 +48,33 @@ CFX_WideString ExportEncodeAttribute(const CFX_WideString& str) {
return textBuf.MakeString();
}
+const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09},
+ {0x0A, 0x0A},
+ {0x0D, 0x0D},
+ {0x20, 0xD7FF},
+ {0xE000, 0xFFFD}};
+bool IsXMLValidChar(wchar_t ch) {
+ int32_t iStart = 0;
+ int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1;
+ while (iStart <= iEnd) {
+ int32_t iMid = (iStart + iEnd) / 2;
+ if (ch < g_XMLValidCharRange[iMid][0]) {
+ iEnd = iMid - 1;
+ } else if (ch > g_XMLValidCharRange[iMid][1]) {
+ iStart = iMid + 1;
+ } else {
+ return true;
+ }
+ }
+ return false;
+}
+
CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
for (int32_t i = 0; i < iLen; i++) {
wchar_t ch = str.GetAt(i);
- if (!FDE_IsXMLValidChar(ch))
+ if (!IsXMLValidChar(ch))
continue;
if (ch == '&') {