Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: xfa/fxfa/parser/xfa_layout_itemlayout.cpp

Issue 1999883002: Use std::map in CXFA_ItemLayoutProcessor (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_layout_itemlayout.cpp
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 8b85ba80750dfdfe1b6e438cdd105423e669ab82..860de2d82cf8e2db07327ae89e62a3dcf52e69b6 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -2974,26 +2974,25 @@ void CXFA_ItemLayoutProcessor::SetCurrentComponentSize(FX_FLOAT fWidth,
FX_FLOAT fHeight) {
m_pLayoutItem->m_sSize = CFX_SizeF(fWidth, fHeight);
}
+
FX_BOOL CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
CXFA_Node* pFormNode) {
- if (pFormNode == NULL) {
+ if (!pFormNode)
return FALSE;
- }
+
CXFA_Node* pTemplate = pFormNode->GetTemplateNode();
- if (!pTemplate) {
+ if (!pTemplate)
pTemplate = pFormNode;
- }
+
CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_ELEMENT_Occur));
int32_t iMax = NodeOccur.GetMax();
- if (iMax > -1) {
- int32_t iCount =
- (int32_t)(uintptr_t)m_PendingNodesCount.GetValueAt(pTemplate);
- if (iCount >= iMax) {
- return FALSE;
- }
- iCount++;
- m_PendingNodesCount.SetAt(pTemplate, (void*)(uintptr_t)(iCount));
+ if (iMax < 0)
return TRUE;
- }
+
+ int32_t iCount = m_PendingNodesCount[pTemplate];
+ if (iCount >= iMax)
+ return FALSE;
+
+ m_PendingNodesCount[pTemplate] = iCount + 1;
return TRUE;
}
« no previous file with comments | « xfa/fxfa/parser/xfa_layout_itemlayout.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698