From a31098417852bdf13e693a6e0913e0706cf94098 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 28 Apr 2016 16:56:08 -0700 Subject: Convert CFX_PtrArray to typesafe CFX_ArrayTemplate, Part 6 Review-Url: https://codereview.chromium.org/1926303002 --- xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'xfa/fxfa/fm2js/xfa_simpleexpression.cpp') diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 468bb3bf89..aad8f7bed0 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -464,20 +464,20 @@ void CXFA_FMNotExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L")"); } -CXFA_FMCallExpression::CXFA_FMCallExpression(uint32_t line, - CXFA_FMSimpleExpression* pExp, - CFX_PtrArray* pArguments, - FX_BOOL bIsSomMethod) +CXFA_FMCallExpression::CXFA_FMCallExpression( + uint32_t line, + CXFA_FMSimpleExpression* pExp, + CFX_ArrayTemplate* pArguments, + FX_BOOL bIsSomMethod) : CXFA_FMUnaryExpression(line, TOKcall, pExp), m_bIsSomMethod(bIsSomMethod), m_pArguments(pArguments) {} CXFA_FMCallExpression::~CXFA_FMCallExpression() { if (m_pArguments) { - for (int i = 0; i < m_pArguments->GetSize(); ++i) { - delete reinterpret_cast(m_pArguments->GetAt(i)); - } - m_pArguments->RemoveAll(); + for (int i = 0; i < m_pArguments->GetSize(); ++i) + delete m_pArguments->GetAt(i); + delete m_pArguments; } } @@ -537,9 +537,7 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << gs_lpStrExpFuncName[GETFMVALUE]; } javascript << FX_WSTRC(L"("); - CXFA_FMSimpleExpression* e = - reinterpret_cast( - m_pArguments->GetAt(i)); + CXFA_FMSimpleExpression* e = m_pArguments->GetAt(i); e->ToJavaScript(javascript); javascript << FX_WSTRC(L")"); if (i + 1 < m_pArguments->GetSize()) { @@ -550,9 +548,7 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { for (int i = 0; i < m_pArguments->GetSize(); ++i) { javascript << gs_lpStrExpFuncName[GETFMVALUE]; javascript << FX_WSTRC(L"("); - CXFA_FMSimpleExpression* e = - reinterpret_cast( - m_pArguments->GetAt(i)); + CXFA_FMSimpleExpression* e = m_pArguments->GetAt(i); e->ToJavaScript(javascript); javascript << FX_WSTRC(L")"); if (i + 1 < m_pArguments->GetSize()) { @@ -586,8 +582,7 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { if (isExistsFunc) { javascript << FX_WSTRC(L"\n(\nfunction ()\n{\ntry\n{\n"); if (m_pArguments && m_pArguments->GetSize() > 0) { - CXFA_FMSimpleExpression* e = - reinterpret_cast(m_pArguments->GetAt(0)); + CXFA_FMSimpleExpression* e = m_pArguments->GetAt(0); javascript << FX_WSTRC(L"return "); e->ToJavaScript(javascript); javascript << FX_WSTRC(L";\n}\n"); @@ -598,8 +593,7 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { L"catch(accessExceptions)\n{\nreturn 0;\n}\n}\n).call(this)\n"); } else if (m_pArguments) { for (int i = 0; i < m_pArguments->GetSize(); ++i) { - CXFA_FMSimpleExpression* e = - reinterpret_cast(m_pArguments->GetAt(i)); + CXFA_FMSimpleExpression* e = m_pArguments->GetAt(i); e->ToJavaScript(javascript); if (i + 1 < m_pArguments->GetSize()) { javascript << FX_WSTRC(L", "); -- cgit v1.2.3