From 9d20d1fc15dba4239642a2e1981e94b244425f11 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 28 Mar 2017 11:16:01 -0700 Subject: Remove CFX_ArrayTempalte from cxfa_resolvprocessor.cpp Change-Id: Ib52f537b6acfbd6573e7ad1be988e6199ca3b7f9 Reviewed-on: https://pdfium-review.googlesource.com/3248 Commit-Queue: Tom Sepez Commit-Queue: dsinclair Reviewed-by: dsinclair --- xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 33 +++++++++++++++---------------- xfa/fxfa/parser/cxfa_resolveprocessor.h | 2 +- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index a00b4a6254..184cebb120 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -476,16 +476,15 @@ int32_t CXFA_ResolveProcessor::ResolveAsterisk(CXFA_ResolveNodesData& rnd) { return pdfium::CollectionSize(rnd.m_Objects); } -int32_t CXFA_ResolveProcessor::ResolvePopStack( - CFX_ArrayTemplate& stack) { - int32_t nType = -1; - int32_t iSize = stack.GetSize() - 1; - if (iSize > -1) { - nType = stack[iSize]; - stack.RemoveAt(iSize, 1); - } +int32_t CXFA_ResolveProcessor::ResolvePopStack(std::vector* stack) { + if (stack->empty()) + return -1; + + int32_t nType = stack->back(); + stack->pop_back(); return nType; } + int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, int32_t nStart, CXFA_ResolveNodesData& rnd) { @@ -500,7 +499,7 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, wchar_t* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); int32_t nNameCount = 0; int32_t nConditionCount = 0; - CFX_ArrayTemplate stack; + std::vector stack; int32_t nType = -1; const wchar_t* pSrc = wsExpression.c_str(); wchar_t wPrev = 0, wCur; @@ -538,19 +537,19 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, switch (nType) { case 0: if (wCur == ']') { - nType = ResolvePopStack(stack); + nType = ResolvePopStack(&stack); bRecursive = false; } break; case 1: if (wCur == ')') { - nType = ResolvePopStack(stack); + nType = ResolvePopStack(&stack); bRecursive = false; } break; case 2: if (wCur == '"') { - nType = ResolvePopStack(stack); + nType = ResolvePopStack(&stack); bRecursive = false; } break; @@ -558,24 +557,24 @@ int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, if (bRecursive) { switch (wCur) { case '[': - stack.Add(nType); + stack.push_back(nType); nType = 0; break; case '(': - stack.Add(nType); + stack.push_back(nType); nType = 1; break; case '"': - stack.Add(nType); + stack.push_back(nType); nType = 2; break; } } wPrev = wCur; } - if (stack.GetSize() > 0) { + if (!stack.empty()) return -1; - } + wsName.ReleaseBuffer(nNameCount); wsName.TrimLeft(); wsName.TrimRight(); diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.h b/xfa/fxfa/parser/cxfa_resolveprocessor.h index e9c2cce439..a44282a43d 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.h +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.h @@ -61,7 +61,7 @@ class CXFA_ResolveProcessor { int32_t ResolveNumberSign(CXFA_ResolveNodesData& rnd); int32_t ResolveAsterisk(CXFA_ResolveNodesData& rnd); int32_t ResolveNormal(CXFA_ResolveNodesData& rnd); - int32_t ResolvePopStack(CFX_ArrayTemplate& stack); + int32_t ResolvePopStack(std::vector* stack); void SetStylesForChild(uint32_t dwParentStyles, CXFA_ResolveNodesData& rnd); void ConditionArray(int32_t iCurIndex, -- cgit v1.2.3