diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-26 14:31:56 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-26 14:31:56 -0800 |
commit | 007e6c0f9559412788b903bcb6a7601e220c3be8 (patch) | |
tree | a2c6bb85eaa2b63fd24ed70fd3c6ddad54e219d5 /xfa/src | |
parent | 281a9eadff15b167e2ee3032e21b83190ad49125 (diff) | |
download | pdfium-007e6c0f9559412788b903bcb6a7601e220c3be8.tar.xz |
Remove some FX_BOOLs
Grepping for FX_BOOL and |==| on the same line gives
a very strong clue that the expression won't be out
of range of the |bool| type iteself.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1736323003 .
Diffstat (limited to 'xfa/src')
-rw-r--r-- | xfa/src/fgas/include/fx_datetime.h | 36 | ||||
-rw-r--r-- | xfa/src/fgas/include/fx_fnt.h | 4 | ||||
-rw-r--r-- | xfa/src/fgas/include/fx_locale.h | 12 | ||||
-rw-r--r-- | xfa/src/fgas/include/fx_utl.h | 2 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_stdfontmgr.h | 6 | ||||
-rw-r--r-- | xfa/src/fgas/src/localization/fx_locale.cpp | 17 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp | 12 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_listboximp.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fwl/src/theme/checkboxtp.cpp | 9 | ||||
-rw-r--r-- | xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxbarcode/oned/BC_OneDReader.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffdocview.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/fxfa_localevalue.h | 6 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_document.h | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_object.h | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_localevalue.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 5 |
19 files changed, 74 insertions, 77 deletions
diff --git a/xfa/src/fgas/include/fx_datetime.h b/xfa/src/fgas/include/fx_datetime.h index 89b8a92d13..fa1ff6e16a 100644 --- a/xfa/src/fgas/include/fx_datetime.h +++ b/xfa/src/fgas/include/fx_datetime.h @@ -102,58 +102,58 @@ class CFX_Unitime { friend CFX_Unitime operator-(FX_UNITIME t1, const CFX_Unitime& t2) { return CFX_Unitime(t1 + t2.m_iUnitime); } - friend FX_BOOL operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime == t2.m_iUnitime; } - friend FX_BOOL operator==(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator==(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime == t2; } - friend FX_BOOL operator==(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator==(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 == t2.m_iUnitime; } - friend FX_BOOL operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime != t2.m_iUnitime; } - friend FX_BOOL operator!=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator!=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime != t2; } - friend FX_BOOL operator!=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator!=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 != t2.m_iUnitime; } - friend FX_BOOL operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime > t2.m_iUnitime; } - friend FX_BOOL operator>(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator>(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime > t2; } - friend FX_BOOL operator>(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator>(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 > t2.m_iUnitime; } - friend FX_BOOL operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime >= t2.m_iUnitime; } - friend FX_BOOL operator>=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator>=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime >= t2; } - friend FX_BOOL operator>=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator>=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 >= t2.m_iUnitime; } - friend FX_BOOL operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime < t2.m_iUnitime; } - friend FX_BOOL operator<(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator<(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime < t2; } - friend FX_BOOL operator<(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator<(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 < t2.m_iUnitime; } - friend FX_BOOL operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime <= t2.m_iUnitime; } - friend FX_BOOL operator<=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator<=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime <= t2; } - friend FX_BOOL operator<=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator<=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 <= t2.m_iUnitime; } diff --git a/xfa/src/fgas/include/fx_fnt.h b/xfa/src/fgas/include/fx_fnt.h index 78c9b5ee13..efb1b03b33 100644 --- a/xfa/src/fgas/include/fx_fnt.h +++ b/xfa/src/fgas/include/fx_fnt.h @@ -123,8 +123,8 @@ typedef struct _FX_FONTDESCRIPTOR : public CFX_Target { } FX_FONTDESCRIPTOR, *FX_LPFONTDESCRIPTOR; typedef FX_FONTDESCRIPTOR const* FX_LPCFONTDESCRIPTOR; typedef CFX_MassArrayTemplate<FX_FONTDESCRIPTOR> CFX_FontDescriptors; -inline FX_BOOL operator==(const FX_FONTDESCRIPTOR& left, - const FX_FONTDESCRIPTOR& right) { +inline bool operator==(const FX_FONTDESCRIPTOR& left, + const FX_FONTDESCRIPTOR& right) { return left.uCharSet == right.uCharSet && left.dwFontStyles == right.dwFontStyles && FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0 && diff --git a/xfa/src/fgas/include/fx_locale.h b/xfa/src/fgas/include/fx_locale.h index cf35491f9b..c558af62d0 100644 --- a/xfa/src/fgas/include/fx_locale.h +++ b/xfa/src/fgas/include/fx_locale.h @@ -164,12 +164,12 @@ class CFX_Decimal { CFX_Decimal(const CFX_ByteStringC& str); operator CFX_WideString() const; operator double() const; - FX_BOOL operator==(const CFX_Decimal& val) const; - FX_BOOL operator<=(const CFX_Decimal& val) const; - FX_BOOL operator>=(const CFX_Decimal& val) const; - FX_BOOL operator!=(const CFX_Decimal& val) const; - FX_BOOL operator<(const CFX_Decimal& val) const; - FX_BOOL operator>(const CFX_Decimal& val) const; + bool operator==(const CFX_Decimal& val) const; + bool operator<=(const CFX_Decimal& val) const; + bool operator>=(const CFX_Decimal& val) const; + bool operator!=(const CFX_Decimal& val) const; + bool operator<(const CFX_Decimal& val) const; + bool operator>(const CFX_Decimal& val) const; CFX_Decimal operator+(const CFX_Decimal& val) const; CFX_Decimal operator-(const CFX_Decimal& val) const; CFX_Decimal operator*(const CFX_Decimal& val) const; diff --git a/xfa/src/fgas/include/fx_utl.h b/xfa/src/fgas/include/fx_utl.h index e95d82005a..8ce736569d 100644 --- a/xfa/src/fgas/include/fx_utl.h +++ b/xfa/src/fgas/include/fx_utl.h @@ -664,7 +664,7 @@ class CFX_CPLTreeNode : public CFX_Target { } return iLevel; } - FX_BOOL IsRootNode() const { return m_pParentNode == NULL; } + bool IsRootNode() const { return !m_pParentNode; } baseType GetData() const { return m_Data; } void SetData(baseType data) { m_Data = data; } diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.h b/xfa/src/fgas/src/font/fx_stdfontmgr.h index 55359de829..de0291e2ef 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.h +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.h @@ -102,13 +102,13 @@ struct FX_FontDescriptorInfo { public: CFX_FontDescriptor* pFont; int32_t nPenalty; - FX_BOOL operator>(const FX_FontDescriptorInfo& x) { + bool operator>(const FX_FontDescriptorInfo& x) { return nPenalty > x.nPenalty; }; - FX_BOOL operator<(const FX_FontDescriptorInfo& x) { + bool operator<(const FX_FontDescriptorInfo& x) { return nPenalty < x.nPenalty; }; - FX_BOOL operator==(const FX_FontDescriptorInfo& x) { + bool operator==(const FX_FontDescriptorInfo& x) { return nPenalty == x.nPenalty; }; }; diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp index ca12dbb69e..fe9ec3f8dd 100644 --- a/xfa/src/fgas/src/localization/fx_locale.cpp +++ b/xfa/src/fgas/src/localization/fx_locale.cpp @@ -4980,9 +4980,8 @@ CFX_Decimal CFX_Decimal::AddOrMinus(const CFX_Decimal& val, if (!isAdding) { rhs.SetNegate(); } - FX_BOOL doRawAdd = (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) == - FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags)); - if (doRawAdd) { + if (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) == + FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags)) { uint64_t phi = lhs.m_uHi, pmid = lhs.m_uMid, plo = lhs.m_uLo; phi += rhs.m_uHi; pmid += rhs.m_uMid; @@ -5087,22 +5086,22 @@ CFX_Decimal CFX_Decimal::Modulus(const CFX_Decimal& val) const { } return lhs; } -FX_BOOL CFX_Decimal::operator==(const CFX_Decimal& val) const { +bool CFX_Decimal::operator==(const CFX_Decimal& val) const { return Compare(val) == 0; } -FX_BOOL CFX_Decimal::operator<=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator<=(const CFX_Decimal& val) const { return Compare(val) <= 0; } -FX_BOOL CFX_Decimal::operator>=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator>=(const CFX_Decimal& val) const { return Compare(val) >= 0; } -FX_BOOL CFX_Decimal::operator!=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator!=(const CFX_Decimal& val) const { return Compare(val) != 0; } -FX_BOOL CFX_Decimal::operator<(const CFX_Decimal& val) const { +bool CFX_Decimal::operator<(const CFX_Decimal& val) const { return Compare(val) < 0; } -FX_BOOL CFX_Decimal::operator>(const CFX_Decimal& val) const { +bool CFX_Decimal::operator>(const CFX_Decimal& val) const { return Compare(val) > 0; } CFX_Decimal CFX_Decimal::operator+(const CFX_Decimal& val) const { diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index b963e1daf8..88add897b7 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -1526,15 +1526,13 @@ void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) { m_pOwner->DispatchKeyEvent(pMsg); return; } - FX_BOOL bSubCtrlKey = pMsg->m_pDstTarget == m_pOwner->m_pInterface; - if (bSubCtrlKey) { + if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) DoSubCtrlKey(pMsg); - } } void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { int32_t iCount = static_cast<CFWL_ComboListImp*>( m_pOwner->m_pListBox->GetImpl())->CountItems(); @@ -1684,8 +1682,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, } void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { CFWL_ComboListImp* pComboList = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()); diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index e924b8b791..1f77f7ad94 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -332,9 +332,9 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, case FWL_VKEY_Down: case FWL_VKEY_Home: case FWL_VKEY_End: { - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; - FX_BOOL bHome = dwKeyCode == FWL_VKEY_Home; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; + const bool bHome = dwKeyCode == FWL_VKEY_Home; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); int32_t iDstItem = -1; diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp index 85dd01f85f..b288e5f19f 100644 --- a/xfa/src/fwl/src/theme/checkboxtp.cpp +++ b/xfa/src/fwl/src/theme/checkboxtp.cpp @@ -49,11 +49,10 @@ FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled; - FX_ARGB argText = - bDisable ? FWLTHEME_CAPACITY_TextDisColor : FWLTHEME_CAPACITY_TextColor; - m_pTextOut->SetTextColor(argText); + m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == + FWL_PARTSTATE_CKB_Disabled + ? FWLTHEME_CAPACITY_TextDisColor + : FWLTHEME_CAPACITY_TextColor); return CFWL_WidgetTP::DrawText(pParams); } FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp index 6ccb2f75d9..fbd0ea1c9e 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp @@ -76,7 +76,7 @@ CFX_PtrArray* CBC_DataMatrixDataBlock::GetDataBlocks( } } } - FX_BOOL specialVersion = version->GetVersionNumber() == 24; + const bool specialVersion = version->GetVersionNumber() == 24; int32_t numLongerBlocks = specialVersion ? 8 : numResultBlocks; for (j = 0; j < numLongerBlocks; j++) { if (rawCodewordsOffset < rawCodewords->GetSize()) { diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp index 7cb8ba51fa..76d05042da 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp @@ -61,7 +61,7 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image, } for (int32_t x = 0; x < maxLines; x++) { int32_t rowStepsAboveOrBelow = (x + 1) >> 1; - FX_BOOL isAbove = (x & 0x01) == 0; + const bool isAbove = (x & 0x01) == 0; int32_t rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow); diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index 218e9e3548..05b78ecca4 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -783,10 +783,10 @@ void CXFA_FFDocView::RunBindItems() { CFX_WideStringC wsValueRef, wsLabelRef; binditems.GetValueRef(wsValueRef); binditems.GetLabelRef(wsLabelRef); - FX_BOOL bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; - FX_BOOL bLabelUseContent = + const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; + const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); - FX_BOOL bValueUseContent = + const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); CFX_WideString wsValue, wsLabel; FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp index e35b14f88f..7d646ca297 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp @@ -374,7 +374,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() { int32_t iRet = ExecuteScript(script, &EventParam); if (iRet == XFA_EVENTERROR_Sucess) { if (GetRawValue() != EventParam.m_wsResult) { - FX_BOOL bNotify = GetDoc()->GetDocType() == XFA_DOCTYPE_Static; + const bool bNotify = GetDoc()->GetDocType() == XFA_DOCTYPE_Static; SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw); UpdateUIDisplay(); if (bNotify) { @@ -770,9 +770,9 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { XFA_ELEMENT eUIType = (XFA_ELEMENT)GetUIType(); int32_t iCapPlacement = caption.GetPlacementType(); FX_FLOAT fCapReserve = caption.GetReserve(); - FX_BOOL bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || - iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; - FX_BOOL bReserveExit = fCapReserve > 0.01; + const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || + iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; + const bool bReserveExit = fCapReserve > 0.01; CXFA_TextLayout* pCapTextLayout = ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pCapTextLayout; if (pCapTextLayout) { diff --git a/xfa/src/fxfa/src/common/fxfa_localevalue.h b/xfa/src/fxfa/src/common/fxfa_localevalue.h index a876d6968e..0ac76c8aed 100644 --- a/xfa/src/fxfa/src/common/fxfa_localevalue.h +++ b/xfa/src/fxfa/src/common/fxfa_localevalue.h @@ -95,9 +95,9 @@ class CXFA_LocaleValue { FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, const CFX_WideString& wsFormat, IFX_Locale* pLocale); - inline FX_BOOL IsNull() const { return m_dwType == XFA_VT_NULL; } - inline FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } - inline FX_BOOL IsValid() const { return m_bValid; } + bool IsNull() const { return m_dwType == XFA_VT_NULL; } + FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } + FX_BOOL IsValid() const { return m_bValid; } protected: FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h index 1e70791748..60706ade98 100644 --- a/xfa/src/fxfa/src/common/xfa_document.h +++ b/xfa/src/fxfa/src/common/xfa_document.h @@ -151,7 +151,7 @@ class CXFA_Document : public IXFA_ObjFactory { void AddPurgeNode(CXFA_Node* pNode); FX_BOOL RemovePurgeNode(CXFA_Node* pNode); void PurgeNodes(); - FX_BOOL HasFlag(FX_DWORD dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } + bool HasFlag(FX_DWORD dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE); FX_BOOL IsInteractive(); XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } diff --git a/xfa/src/fxfa/src/common/xfa_object.h b/xfa/src/fxfa/src/common/xfa_object.h index be2b604c7f..7819c5f6ba 100644 --- a/xfa/src/fxfa/src/common/xfa_object.h +++ b/xfa/src/fxfa/src/common/xfa_object.h @@ -141,8 +141,8 @@ class CXFA_Node : public CXFA_Object { IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } IFDE_XMLNode* CreateXMLMappingNode(); FX_BOOL IsNeedSavingXMLNode(); - inline FX_DWORD GetNameHash() const { return m_dwNameHash; } - inline FX_BOOL IsUnnamed() const { return m_dwNameHash == 0; } + FX_DWORD GetNameHash() const { return m_dwNameHash; } + bool IsUnnamed() const { return m_dwNameHash == 0; } CXFA_Node* GetModelNode(); void UpdateNameHash(); FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE); diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 819a5e121b..719c9dcf78 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -817,12 +817,12 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( XFA_ItemLayoutProcessorStages& nCurStage, CXFA_Node*& pNextContainer, FX_BOOL& bLastKeepNode) { - FX_BOOL bCanSplite = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; + const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; FX_BOOL bNextKeep = FALSE; if (XFA_ExistContainerKeep(pNextContainer, FALSE)) { bNextKeep = TRUE; } - if (bNextKeep && !bCanSplite) { + if (bNextKeep && !bCanSplit) { if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { m_pKeepHeadNode = pNextContainer; m_bIsProcessKeep = TRUE; diff --git a/xfa/src/fxfa/src/parser/xfa_localevalue.cpp b/xfa/src/fxfa/src/parser/xfa_localevalue.cpp index 2222d0cf9c..838634d1e9 100644 --- a/xfa/src/fxfa/src/parser/xfa_localevalue.cpp +++ b/xfa/src/fxfa/src/parser/xfa_localevalue.cpp @@ -597,8 +597,10 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { return FALSE; } - FX_BOOL bSymbol = (wsDate.Find(0x2D) == -1) ? FALSE : TRUE; - FX_WORD wYear = 0, wMonth = 0, wDay = 0; + const bool bSymbol = wsDate.Find(0x2D) != -1; + FX_WORD wYear = 0; + FX_WORD wMonth = 0; + FX_WORD wDay = 0; const FX_WCHAR* pDate = (const FX_WCHAR*)wsDate; int nIndex = 0, nStart = 0; while (pDate[nIndex] != '\0' && nIndex < wCountY) { @@ -680,7 +682,7 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { const FX_WORD wCountM = 2; const FX_WORD wCountS = 2; const FX_WORD wCountF = 3; - FX_BOOL bSymbol = (wsTime.Find(':') == -1) ? FALSE : TRUE; + const bool bSymbol = wsTime.Find(':') != -1; FX_WORD wHour = 0; FX_WORD wMinute = 0; FX_WORD wSecond = 0; diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index 67028ee3cd..65992c4201 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -2319,8 +2319,7 @@ void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { return; } int32_t iIndex = pArguments->GetInt32(0); - FX_BOOL bAdd = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; - if (bAdd) { + if (pArguments->GetInt32(1) != 0) { pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE); } else { if (pWidgetData->GetItemState(iIndex)) { @@ -3431,7 +3430,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { } int32_t argc = pArguments->GetLength(); if (argc == 1) { - FX_BOOL bScriptFlags = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; + const bool bScriptFlags = pArguments->GetInt32(0) != 0; IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; |