summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_dataexporter.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-20 13:46:05 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-20 21:25:27 +0000
commitc16ab75eb98733c857723f9c2947c77a56b2bb02 (patch)
treebc3849c3fbb7523902f2df0063ee5b32f196a064 /xfa/fxfa/parser/cxfa_dataexporter.cpp
parent88008a2be11ccbb5001dc540e96024a9641e4915 (diff)
downloadpdfium-c16ab75eb98733c857723f9c2947c77a56b2bb02.tar.xz
Remove hand-written bsearch from cxfa_dataexporter.cpp
Binary search over an array of 5 elements is overkill. Change-Id: I3a39e82035d67564012c11aaf78045e435d59a41 Reviewed-on: https://pdfium-review.googlesource.com/4396 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_dataexporter.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 70748f2666..dda93a36fc 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -49,25 +49,9 @@ 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;
+ return ch == 0x09 || ch == 0x0A || ch == 0x0D ||
+ (ch >= 0x20 && ch <= 0xD7FF) || (ch >= 0xE000 && ch <= 0xFFFD);
}
CFX_WideString ExportEncodeContent(const CFX_WideStringC& str) {