summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-20 10:21:36 -0700
committerLei Zhang <thestig@chromium.org>2015-10-20 10:21:36 -0700
commit23378cdf2c0be861bddfffd82aed8cd6b07d77bf (patch)
tree325cc64b1d407e56bd603b01f3a08ec32144f2f1
parentdd11f8615fc20e638fbb6f6281c4564ed8927af3 (diff)
downloadpdfium-23378cdf2c0be861bddfffd82aed8cd6b07d77bf.tar.xz
XFA: Remove cond ? TRUE : FALSE.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1409323003 .
-rw-r--r--core/src/fxcodec/codec/fx_codec_progress.cpp2
-rw-r--r--xfa/src/fdp/src/fde/fde_gedevice.cpp3
-rw-r--r--xfa/src/fdp/src/tto/fde_textout.cpp30
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp6
-rw-r--r--xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp6
-rw-r--r--xfa/src/fwl/src/core/fwl_formimp.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_object_imp.cpp8
-rw-r--r--xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_imp.cpp4
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp4
-rw-r--r--xfa/src/fxjse/src/class.cpp2
13 files changed, 35 insertions, 38 deletions
diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp
index 0ad4c2a668..885b751a1b 100644
--- a/core/src/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/src/fxcodec/codec/fx_codec_progress.cpp
@@ -716,7 +716,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule,
pal_index = pCodec->m_GifTransIndex;
}
FXSYS_memset(pCodec->m_pDecodeBuf, pal_index, pCodec->m_SrcWidth);
- FX_BOOL bLastPass = ((row_num % 2) == 1) ? TRUE : FALSE;
+ FX_BOOL bLastPass = (row_num % 2) == 1;
int32_t line = row_num + pCodec->m_GifFrameRect.top;
int32_t left = pCodec->m_GifFrameRect.left;
FXSYS_memcpy(pCodec->m_pDecodeBuf + left, row_buf, img_width);
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp
index 4b716b4941..c50fcca1c6 100644
--- a/xfa/src/fdp/src/fde/fde_gedevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp
@@ -169,8 +169,7 @@ FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush,
SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight;
SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
- SubstFxFont.m_bItlicCJK =
- dwFontStyle & FX_FONTSTYLE_Italic ? TRUE : FALSE;
+ SubstFxFont.m_bItlicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
#endif
for (int32_t i = 0; i < iCount; ++i) {
pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex);
diff --git a/xfa/src/fdp/src/tto/fde_textout.cpp b/xfa/src/fdp/src/tto/fde_textout.cpp
index 4661bd6614..d7e17628ee 100644
--- a/xfa/src/fdp/src/tto/fde_textout.cpp
+++ b/xfa/src/fdp/src/tto/fde_textout.cpp
@@ -232,8 +232,8 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
SetLineWidth(rect);
m_iTotalLines = 0;
const FX_WCHAR* pStr = pwsStr;
- FX_BOOL bHotKey = (m_dwStyles & FDE_TTOSTYLE_HotKey) ? TRUE : FALSE;
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
+ FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fWidth = 0.0f;
FX_FLOAT fHeight = 0.0f;
FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right();
@@ -313,7 +313,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(FX_DWORD dwBreakStatus,
}
FX_FLOAT fLineStep =
(m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
- FX_BOOL bLineWrap = (m_dwStyles & FDE_TTOSTYLE_LineWrap) ? TRUE : FALSE;
+ FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
FX_FLOAT fLineWidth = 0.0f;
int32_t iCount = m_pTxtBreak->CountBreakPieces();
for (int32_t i = 0; i < iCount; i++) {
@@ -501,9 +501,9 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
FX_WCHAR* pStr = m_wsText.GetBuffer(iLength);
int32_t iTxtLength = iLength;
ExpandBuffer(iTxtLength, 0);
- FX_BOOL bHotKey = (m_dwStyles & FDE_TTOSTYLE_HotKey) ? TRUE : FALSE;
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
- FX_BOOL bLineWrap = (m_dwStyles & FDE_TTOSTYLE_LineWrap) ? TRUE : FALSE;
+ FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
+ FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
FX_FLOAT fLineStep =
(m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
FX_FLOAT fLineStop = bVertical ? rect.left : rect.bottom();
@@ -564,9 +564,9 @@ FX_BOOL CFDE_TextOut::RetriecePieces(FX_DWORD dwBreakStatus,
int32_t& iPieceWidths,
FX_BOOL bReload,
const CFX_RectF& rect) {
- FX_BOOL bSingleLine = (m_dwStyles & FDE_TTOSTYLE_SingleLine) ? TRUE : FALSE;
- FX_BOOL bLineWrap = (m_dwStyles & FDE_TTOSTYLE_LineWrap) ? TRUE : FALSE;
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
+ FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine);
+ FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fLineStep =
(m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
if (bVertical) {
@@ -709,7 +709,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) {
}
void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText;
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
int32_t iPieceWidths = 0;
FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0);
int32_t iStartChar = pPiece->iStartChar;
@@ -739,7 +739,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
m_pTxtBreak->Reset();
}
void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom();
int32_t iLines = m_ttoLines.GetSize();
if (iLines < 1) {
@@ -842,10 +842,10 @@ void CFDE_TextOut::ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr) {
tr.pRect = &pPiece->rtPiece;
}
void CFDE_TextOut::DrawLine(const FDE_LPTTOPIECE pPiece, IFDE_Pen*& pPen) {
- FX_BOOL bUnderLine = (m_dwStyles & FDE_TTOSTYLE_Underline) ? TRUE : FALSE;
- FX_BOOL bStrikeOut = (m_dwStyles & FDE_TTOSTYLE_Strikeout) ? TRUE : FALSE;
- FX_BOOL bHotKey = (m_dwStyles & FDE_TTOSTYLE_HotKey) ? TRUE : FALSE;
- FX_BOOL bVertical = (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) ? TRUE : FALSE;
+ FX_BOOL bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline);
+ FX_BOOL bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout);
+ FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey);
+ FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
if (!bUnderLine && !bStrikeOut && !bHotKey) {
return;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
index 4460a8d0e1..64e9b40c11 100644
--- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp
@@ -869,13 +869,13 @@ FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) {
return m_pEdit->Paste(wsPaste);
}
FX_BOOL CFWL_ComboBoxImp::EditSelectAll() {
- return (m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded;
}
FX_BOOL CFWL_ComboBoxImp::EditDelete() {
- return (m_pEdit->ClearText() == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->ClearText() == FWL_ERR_Succeeded;
}
FX_BOOL CFWL_ComboBoxImp::EditDeSelect() {
- return (m_pEdit->ClearSelections() == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->ClearSelections() == FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
index c378ccde02..866dc492aa 100644
--- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp
@@ -662,13 +662,13 @@ FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) {
return m_pEdit->Paste(wsPaste);
}
FX_BOOL CFWL_DateTimePickerImp::SelectAll() {
- return (m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded;
}
FX_BOOL CFWL_DateTimePickerImp::Delete() {
- return (m_pEdit->ClearText() == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->ClearText() == FWL_ERR_Succeeded;
}
FX_BOOL CFWL_DateTimePickerImp::DeSelect() {
- return (m_pEdit->ClearSelections() == FWL_ERR_Succeeded) ? TRUE : FALSE;
+ return m_pEdit->ClearSelections() == FWL_ERR_Succeeded;
}
FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp
index 85139ca1a1..2facbf3757 100644
--- a/xfa/src/fwl/src/core/fwl_formimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_formimp.cpp
@@ -885,7 +885,7 @@ void CFWL_FormImp::SetThemeData() {
}
FX_BOOL CFWL_FormImp::HasIcon() {
IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
- return pData->GetIcon(m_pInterface, FALSE) ? TRUE : FALSE;
+ return !!pData->GetIcon(m_pInterface, FALSE);
}
void CFWL_FormImp::UpdateIcon() {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
index 42652ad57a..8da91847fc 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp
@@ -1201,7 +1201,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument,
if (pDataNode) {
XFA_DataMerge_CreateDataBinding(
pFormNode, pDataNode,
- rs.dwFlags == XFA_RESOVENODE_RSTYPE_ExistNodes ? TRUE : FALSE);
+ rs.dwFlags == XFA_RESOVENODE_RSTYPE_ExistNodes);
} else {
XFA_DataMerge_FormValueNode_MatchNoneCreateChild(pFormNode);
}
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 1894480068..4ab1dc96f2 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -1432,7 +1432,7 @@ FX_BOOL CXFA_LayoutPageMgr::GetNextAvailContentHeight(FX_FLOAT fChildHeight) {
if (pCurContentNode) {
FX_FLOAT fNextContentHeight =
pCurContentNode->GetMeasure(XFA_ATTRIBUTE_H).ToUnit(XFA_UNIT_Pt);
- return fNextContentHeight > fChildHeight ? TRUE : FALSE;
+ return fNextContentHeight > fChildHeight;
}
CXFA_Node* pPageNode = GetCurrentContainerRecord()->pCurPageArea->m_pFormNode;
CXFA_Node* pOccurNode = pPageNode->GetFirstChildByClass(XFA_ELEMENT_Occur);
diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
index db059675f8..0bacfcd074 100644
--- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
@@ -1752,8 +1752,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
} else {
CFX_WideString wsValue = GetScriptContent(TRUE);
- FXJSE_Value_SetBoolean(hValue,
- wsValue.Equal(FX_WSTRC(L"1")) ? TRUE : FALSE);
+ FXJSE_Value_SetBoolean(hValue, wsValue.Equal(FX_WSTRC(L"1")));
}
}
struct XFA_ExecEventParaInfo {
@@ -5449,8 +5448,7 @@ CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument,
}
int32_t CXFA_AttachNodeList::GetLength() {
return m_pAttachNode->CountChildren(
- XFA_ELEMENT_UNKNOWN,
- m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform ? TRUE : FALSE);
+ XFA_ELEMENT_UNKNOWN, m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
}
FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) {
CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent);
@@ -5473,5 +5471,5 @@ FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
return m_pAttachNode->GetChild(
iIndex, XFA_ELEMENT_UNKNOWN,
- m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform ? TRUE : FALSE);
+ m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
}
diff --git a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
index ab9e3331ca..c239ac1d70 100644
--- a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp
@@ -837,7 +837,7 @@ int32_t CXFA_Line::GetHand() {
}
FX_BOOL CXFA_Line::GetSlop() {
XFA_ATTRIBUTEENUM eSlop = m_pNode->GetEnum(XFA_ATTRIBUTE_Slope);
- return (eSlop == XFA_ATTRIBUTEENUM_Slash) ? TRUE : FALSE;
+ return eSlop == XFA_ATTRIBUTEENUM_Slash;
}
CXFA_Edge CXFA_Line::GetEdge() {
return CXFA_Edge(m_pNode->GetChild(0, XFA_ELEMENT_Edge));
diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
index f8b8f76ae9..34668ea66a 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
@@ -672,7 +672,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
FX_BOOL bCreate =
m_pResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode(
rndFind.m_wsName, rndFind.m_wsCondition,
- nStart == wsExpression.GetLength() ? TRUE : FALSE, this);
+ nStart == wsExpression.GetLength(), this);
if (bCreate) {
continue;
} else {
@@ -732,7 +732,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode,
FX_BOOL bCreate =
m_pResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode(
rndFind.m_wsName, rndFind.m_wsCondition,
- nStart == wsExpression.GetLength() ? TRUE : FALSE, this);
+ nStart == wsExpression.GetLength(), this);
if (bCreate) {
continue;
} else {
diff --git a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
index dfbf22d7dc..7919395a56 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp
@@ -314,7 +314,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
if (m_pNodeHelper->XFA_NodeIsTransparent((CXFA_Node*)curNode)) {
m_pNodeHelper->XFA_CountSiblings(
(CXFA_Node*)nodes[0], XFA_LOGIC_Transparent, &upArrayNodes,
- dwStyles & XFA_RESOLVENODE_TagName ? TRUE : FALSE);
+ !!(dwStyles & XFA_RESOLVENODE_TagName));
}
if (upArrayNodes.GetSize() > nodes.GetSize()) {
upArrayNodes[0] = (CXFA_Node*)nodes[0];
@@ -463,7 +463,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal(
CXFA_NodeArray upArrayNodes;
m_pNodeHelper->XFA_CountSiblings(
(CXFA_Node*)nodes[0], XFA_LOGIC_Transparent, &upArrayNodes,
- dwStyles & XFA_RESOLVENODE_TagName ? TRUE : FALSE);
+ !!(dwStyles & XFA_RESOLVENODE_TagName));
if (upArrayNodes.GetSize() > nodes.GetSize()) {
upArrayNodes[0] = (CXFA_Node*)nodes[0];
nodes.RemoveAll();
diff --git a/xfa/src/fxjse/src/class.cpp b/xfa/src/fxjse/src/class.cpp
index 891c7e1002..04b087f37f 100644
--- a/xfa/src/fxjse/src/class.cpp
+++ b/xfa/src/fxjse/src/class.cpp
@@ -183,7 +183,7 @@ FXJSE_HVALUE CFXJSE_Arguments::GetValue(int32_t index) const {
FX_BOOL CFXJSE_Arguments::GetBoolean(int32_t index) const {
const CFXJSE_ArgumentsImpl* lpArguments =
reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);
- return (*lpArguments->m_pInfo)[index]->BooleanValue() ? TRUE : FALSE;
+ return (*lpArguments->m_pInfo)[index]->BooleanValue();
}
int32_t CFXJSE_Arguments::GetInt32(int32_t index) const {
const CFXJSE_ArgumentsImpl* lpArguments =