summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_valuearray.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-27 16:03:43 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 13:58:08 +0000
commit369fe1f7f9f3a424ee3cf8f992c3128db27fa479 (patch)
treea263d96bf4b45e572157d1c093dc321d941be3fd /xfa/fxfa/parser/cxfa_valuearray.cpp
parent1ded376f257f0894d68a0be68d0628171792e823 (diff)
downloadpdfium-369fe1f7f9f3a424ee3cf8f992c3128db27fa479.tar.xz
Remove CFX_ArrayTemplate in CXFA_ValueArray
Change-Id: I68f317b9fb9b162a5d99cdacc619c85f96a5bf52 Reviewed-on: https://pdfium-review.googlesource.com/3239 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_valuearray.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_valuearray.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/xfa/fxfa/parser/cxfa_valuearray.cpp b/xfa/fxfa/parser/cxfa_valuearray.cpp
index 1170010139..eded624c36 100644
--- a/xfa/fxfa/parser/cxfa_valuearray.cpp
+++ b/xfa/fxfa/parser/cxfa_valuearray.cpp
@@ -6,20 +6,20 @@
#include "xfa/fxfa/parser/cxfa_valuearray.h"
+#include <algorithm>
+
#include "xfa/fxfa/parser/cxfa_scriptcontext.h"
CXFA_ValueArray::CXFA_ValueArray(v8::Isolate* pIsolate)
: m_pIsolate(pIsolate) {}
-CXFA_ValueArray::~CXFA_ValueArray() {
- for (int32_t i = 0; i < GetSize(); i++)
- delete GetAt(i);
-}
+CXFA_ValueArray::~CXFA_ValueArray() {}
std::vector<CXFA_Object*> CXFA_ValueArray::GetAttributeObject() {
- std::vector<CXFA_Object*> objArray;
- for (int32_t i = 0; i < GetSize(); i++)
- objArray.push_back(CXFA_ScriptContext::ToObject(GetAt(i), nullptr));
-
- return objArray;
+ std::vector<CXFA_Object*> result(m_Values.size());
+ std::transform(m_Values.begin(), m_Values.end(), result.begin(),
+ [](const std::unique_ptr<CFXJSE_Value>& value) {
+ return CXFA_ScriptContext::ToObject(value.get(), nullptr);
+ });
+ return result;
}