summaryrefslogtreecommitdiff
path: root/fpdfsdk/fsdk_actionhandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-02 15:10:58 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-02 23:22:07 +0000
commitd7188f7f91a98906743c48f6aa92ad041d4b51b2 (patch)
tree060a870bbfd7ecd2220c665c3a1441c81247a240 /fpdfsdk/fsdk_actionhandler.cpp
parenta290470880669630dba46ebe0c94b44f36f34f00 (diff)
downloadpdfium-d7188f7f91a98906743c48f6aa92ad041d4b51b2.tar.xz
Remove some more |new|s, part 11chromium/3088
Using vector<uint8_t> as a buffer. Change-Id: I38a8a05e7ec1355980d17533a2c8336e733aa6f6 Reviewed-on: https://pdfium-review.googlesource.com/4791 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fsdk_actionhandler.cpp')
-rw-r--r--fpdfsdk/fsdk_actionhandler.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index dc99f32f34..16724d5ac4 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/fsdk_actionhandler.h"
#include <set>
+#include <vector>
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfdoc/cpdf_formfield.h"
@@ -420,19 +421,13 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(
int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
int nFitType = MyDest.GetZoomMode();
const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
- float* pPosAry = nullptr;
- int sizeOfAry = 0;
+ std::vector<float> posArray;
if (pMyArray) {
- pPosAry = new float[pMyArray->GetCount()];
- int j = 0;
- for (size_t i = 2; i < pMyArray->GetCount(); i++) {
- pPosAry[j++] = pMyArray->GetFloatAt(i);
- }
- sizeOfAry = j;
+ for (size_t i = 2; i < pMyArray->GetCount(); i++)
+ posArray.push_back(pMyArray->GetFloatAt(i));
}
-
- pFormFillEnv->DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
- delete[] pPosAry;
+ pFormFillEnv->DoGoToAction(nPageIndex, nFitType, posArray.data(),
+ posArray.size());
}
void CPDFSDK_ActionHandler::DoAction_GoToR(