summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_utils.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-27 18:28:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-27 18:28:06 +0000
commitf351ba03ebf31103c0a6a0c00b1477d39c060139 (patch)
treedf924970828054a2ec8c1fa00c7546a15de106c8 /xfa/fxfa/parser/xfa_utils.cpp
parent9f0bba48c208722c8d05eaa5382254f3183c65b7 (diff)
downloadpdfium-f351ba03ebf31103c0a6a0c00b1477d39c060139.tar.xz
Add some helpers for attribute lookup
This CL adds helpers to CXFA_Node to convert from strings to attributes and from attributes to their string names. A static_assert was added to make sure the list of attributes is the same size as the attribute data so the checks can be removed. Change-Id: Idebc65021d71f604bcf498e4cf42252af00d802b Reviewed-on: https://pdfium-review.googlesource.com/19270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_utils.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index b17a7535eb..03b8943a1f 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -284,9 +284,8 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName) {
}
const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_Attribute eName) {
- return (static_cast<uint8_t>(eName) < g_iXFAAttributeCount)
- ? (g_XFAAttributeData + static_cast<uint8_t>(eName))
- : nullptr;
+ ASSERT(static_cast<uint8_t>(eName) < g_iXFAAttributeCount);
+ return g_XFAAttributeData + static_cast<uint8_t>(eName);
}
const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(