summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_utils.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-08 18:01:31 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-08 18:01:31 +0000
commit1d86501aa9ee49890fbb43db60333a42f947cd74 (patch)
tree65b0c342fa74b11371a640c4444b87b6d6a6f5ba /xfa/fxfa/parser/xfa_utils.cpp
parent7055dffad92bd7be7cdb20ed12d5cc5890177e7a (diff)
downloadpdfium-1d86501aa9ee49890fbb43db60333a42f947cd74.tar.xz
Convert XFA_ATTRIBUTE to an enum class
This CL converts the XFA_ATTRIBUTE enum to an enum class and fixes up various usages. Change-Id: I3dd17cc412d97eb212a65ce63bb9fa19605e1e91 Reviewed-on: https://pdfium-review.googlesource.com/18050 Reviewed-by: Tom Sepez <tsepez@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.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index b9b1eb6fd6..8cb9bef4a2 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -221,7 +221,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) {
CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pFirstChild &&
pFirstChild->GetElementType() == XFA_Element::ChoiceList) {
- bRet = pFirstChild->JSNode()->GetEnum(XFA_ATTRIBUTE_Open) ==
+ bRet = pFirstChild->JSNode()->GetEnum(XFA_Attribute::Open) ==
XFA_ATTRIBUTEENUM_MultiSelect;
}
}
@@ -271,7 +271,7 @@ const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName(
}
const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement,
- XFA_ATTRIBUTE eAttribute,
+ XFA_Attribute eAttribute,
XFA_ATTRIBUTETYPE eType) {
int32_t iStart = 0, iEnd = g_iXFANotsureCount - 1;
do {
@@ -360,7 +360,8 @@ const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement,
return g_XFAElementPropertyData + pElement->wStart;
}
-const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount) {
+const XFA_Attribute* XFA_GetElementAttributes(XFA_Element eElement,
+ int32_t& iCount) {
if (eElement == XFA_Element::Unknown)
return nullptr;
@@ -393,7 +394,7 @@ XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName) {
}
CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
- XFA_ATTRIBUTE eAttribute,
+ XFA_Attribute eAttribute,
uint32_t dwPacket) {
void* pValue;
if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
@@ -405,7 +406,7 @@ CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
bool XFA_GetAttributeDefaultValue(void*& pValue,
XFA_Element eElement,
- XFA_ATTRIBUTE eAttribute,
+ XFA_Attribute eAttribute,
XFA_ATTRIBUTETYPE eType,
uint32_t dwPacket) {
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute);
@@ -443,9 +444,10 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const WideStringView& wsName) {
return nullptr;
}
-const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) {
- return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName)
- : nullptr;
+const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_Attribute eName) {
+ return (static_cast<uint8_t>(eName) < g_iXFAAttributeCount)
+ ? (g_XFAAttributeData + static_cast<uint8_t>(eName))
+ : nullptr;
}
const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName(