From 9d47de6b27b167db46b6aba38352fc42a8b6adae Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 14:07:17 +0000 Subject: Convert TryEnum to return an optional This CL converts CJX_Node::TryEnum to return a pdfium::Optional instead of a bool with an out parameter. Change-Id: Icc1b063ce51656cc5e467aba358eb9e7d6754fea Reviewed-on: https://pdfium-review.googlesource.com/18512 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_filldata.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_filldata.cpp') diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp index 4e1e5f1af2..da249548f9 100644 --- a/xfa/fxfa/parser/cxfa_filldata.cpp +++ b/xfa/fxfa/parser/cxfa_filldata.cpp @@ -86,15 +86,15 @@ int32_t CXFA_FillData::GetLinear(FX_ARGB& endColor) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear, true); - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight; - pNode->JSNode()->TryEnum(XFA_Attribute::Type, eAttr, true); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional wsColor = pColor->JSNode()->TryCData(XFA_Attribute::Value, false); if (wsColor) endColor = CXFA_DataData::ToColor(wsColor->AsStringView()); } - return eAttr; + return pNode->JSNode() + ->TryEnum(XFA_Attribute::Type, true) + .value_or(XFA_ATTRIBUTEENUM_ToRight); } int32_t CXFA_FillData::GetRadial(FX_ARGB& endColor) { @@ -102,13 +102,13 @@ int32_t CXFA_FillData::GetRadial(FX_ARGB& endColor) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial, true); - XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; - pNode->JSNode()->TryEnum(XFA_Attribute::Type, eAttr, true); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional wsColor = pColor->JSNode()->TryCData(XFA_Attribute::Value, false); if (wsColor) endColor = CXFA_DataData::ToColor(wsColor->AsStringView()); } - return eAttr; + return pNode->JSNode() + ->TryEnum(XFA_Attribute::Type, true) + .value_or(XFA_ATTRIBUTEENUM_ToEdge); } -- cgit v1.2.3