diff options
author | weili <weili@chromium.org> | 2016-05-20 15:38:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-20 15:38:30 -0700 |
commit | 038aa531bcf1a76764d3cef46fd9b8e08b166dae (patch) | |
tree | d1ef7d15ff37e4c98d1d7522b225755ba99bc330 /xfa/fxfa/parser | |
parent | dc3ccdfb49c4d533d524d2084a7ebe5117f35934 (diff) | |
download | pdfium-038aa531bcf1a76764d3cef46fd9b8e08b166dae.tar.xz |
Clean up XFA code which causes warnings
This is part of efforts to bring XFA to chromium_code standard.
The warnings are from unreachable code, or using potentially
uninitialized variables, or using assignment within a condition.
This change list only contains easy to fix cases. More cleanups
will follow.
BUG=pdfium:29
Review-Url: https://codereview.chromium.org/1998873002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/xfa_basic_imp.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_localemgr.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_parser_imp.cpp | 1 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils_imp.cpp | 2 |
7 files changed, 9 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index 728ecfc319..759d530439 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -488,7 +488,6 @@ FX_BOOL CXFA_Measurement::ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const { fValue = 0; return FALSE; } - return FALSE; } XFA_UNIT CXFA_Measurement::GetUnit(const CFX_WideStringC& wsUnit) { if (wsUnit == FX_WSTRC(L"mm")) { diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 41a0acd70b..5bd8f08970 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -886,13 +886,13 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet( pTemplateChild, TRUE); } else if (pTemplateChild->GetObjectType() == XFA_OBJECTTYPE_ContainerNode) { - CXFA_Node* pDataMatch; bSelfMatch = FALSE; eBindMatch = XFA_ATTRIBUTEENUM_None; + CXFA_Node* pDataMatch; if (eRelation != XFA_ATTRIBUTEENUM_Ordered && (pDataMatch = XFA_DataMerge_FindMatchingDataNode( pDocument, pTemplateChild, pDataScope, bAccessedDataDOM, - FALSE, NULL, bSelfMatch, eBindMatch))) { + FALSE, NULL, bSelfMatch, eBindMatch)) != nullptr) { XFA_DataMerge_RecurseRecord sNewRecord = {pTemplateChild, pDataMatch}; if (bSelfMatch) { diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 0982537b15..83c7cf025d 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1123,9 +1123,8 @@ static uint16_t XFA_GetLanguage(CFX_WideString wsLanguage) { CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) : m_dwLocaleFlags(0x00) { m_dwDeflcid = XFA_GetLanguage(wsDeflcid); - CXFA_Node* pNodeLocale = NULL; - if (pLocaleSet && - (pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild))) { + if (pLocaleSet) { + CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNodeLocale) { m_LocaleArray.Add(new CXFA_NodeLocale(pNodeLocale)); pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 0fbde1f160..6a6303e64e 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -4504,7 +4504,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, } CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); - CXFA_Node* pNewNode; + CXFA_Node* pNewNode = nullptr; for (; iCount <= index; iCount++) { pNewNode = pFactory->CreateNode(pPacket, eProperty); if (!pNewNode) { diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 3369e59479..9cadcc6d1c 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -362,7 +362,6 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, default: return ParseAsXDPPacket_User(pXMLDocumentNode, ePacketID); } - return NULL; } CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( CFDE_XMLNode* pXMLDocumentNode, diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 821e485e25..d6633a4c7f 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -120,7 +120,7 @@ class CXFA_NodeIteratorTemplate { NodeType** ppNode = NULL; NodeType* pCurrent = GetCurrent(); while (m_NodeStack.GetSize() > 0) { - while ((ppNode = m_NodeStack.GetTopElement())) { + while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { if (pCurrent != *ppNode) { return *ppNode; } @@ -130,7 +130,7 @@ class CXFA_NodeIteratorTemplate { } m_NodeStack.Push(pChild); } - while ((ppNode = m_NodeStack.GetTopElement())) { + while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); m_NodeStack.Pop(); if (m_NodeStack.GetSize() == 0) { @@ -145,8 +145,8 @@ class CXFA_NodeIteratorTemplate { return NULL; } NodeType* SkipChildrenAndMoveToNext() { - NodeType** ppNode = NULL; - while ((ppNode = m_NodeStack.GetTopElement())) { + NodeType** ppNode = nullptr; + while ((ppNode = m_NodeStack.GetTopElement()) != nullptr) { NodeType* pNext = TraverseStrategy::GetNextSibling(*ppNode); m_NodeStack.Pop(); if (m_NodeStack.GetSize() == 0) { diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 77cac00b89..d576b4de06 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -255,14 +255,12 @@ FX_BOOL XFA_IsLayoutElement(XFA_ELEMENT eElement, FX_BOOL bLayoutContainer) { case XFA_ELEMENT_Subform: case XFA_ELEMENT_ExclGroup: case XFA_ELEMENT_SubformSet: - return TRUE; case XFA_ELEMENT_PageArea: case XFA_ELEMENT_Form: return TRUE; default: return FALSE; } - return FALSE; } static const FX_DOUBLE fraction_scales[] = {0.1, |