From b31433fdaf92a15edfd920043aea5293ccc7e73e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 19:06:57 +0000 Subject: Remove default value from CJX_Node::TryInteger This CL removes the default param from TryInteger and inlines into the call sites. Change-Id: If3325c717a1127d4dcf665a12980925877988a9c Reviewed-on: https://pdfium-review.googlesource.com/17531 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/cjx_node.h | 4 +--- xfa/fxfa/parser/cxfa_fill.cpp | 2 +- xfa/fxfa/parser/cxfa_font.cpp | 4 ++-- xfa/fxfa/parser/cxfa_widgetdata.cpp | 34 ++++++++++++++++++++++------------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index 963cf0de4e..ea66f13ed8 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -80,9 +80,7 @@ class CJX_Node : public CJX_Object { bool bSyncData); WideString GetContent(); - bool TryInteger(XFA_ATTRIBUTE eAttr, - int32_t& iValue, - bool bUseDefault = true); + bool TryInteger(XFA_ATTRIBUTE eAttr, int32_t& iValue, bool bUseDefault); bool SetInteger(XFA_ATTRIBUTE eAttr, int32_t iValue, bool bNotify = false); int32_t GetInteger(XFA_ATTRIBUTE eAttr); diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index 4cce86fd43..96290bc821 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -69,7 +69,7 @@ int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple, true); int32_t eAttr = 50; - pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Rate, eAttr); + pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Rate, eAttr, true); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 0e24064ae8..4fc0a57092 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -46,13 +46,13 @@ float CXFA_Font::GetLetterSpacing() { int32_t CXFA_Font::GetLineThrough() { int32_t iValue = 0; - m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_LineThrough, iValue); + m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_LineThrough, iValue, true); return iValue; } int32_t CXFA_Font::GetUnderline() { int32_t iValue = 0; - m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Underline, iValue); + m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Underline, iValue, true); return iValue; } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index f6e0f7d55b..a0ac520981 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -1403,23 +1403,33 @@ int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) { } bool CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { - if (CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal)) - return pChild->JSNode()->TryInteger(XFA_ATTRIBUTE_FracDigits, - iFracDigits); - } iFracDigits = -1; - return false; + + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value); + if (!pNode) + return false; + + CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal); + if (!pChild) + return false; + + return pChild->JSNode()->TryInteger(XFA_ATTRIBUTE_FracDigits, iFracDigits, + true); } bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { - if (CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal)) - return pChild->JSNode()->TryInteger(XFA_ATTRIBUTE_LeadDigits, - iLeadDigits); - } iLeadDigits = -1; - return false; + + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value); + if (!pNode) + return false; + + CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal); + if (!pChild) + return false; + + return pChild->JSNode()->TryInteger(XFA_ATTRIBUTE_LeadDigits, iLeadDigits, + true); } bool CXFA_WidgetData::SetValue(const WideString& wsValue, -- cgit v1.2.3