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

Side by Side Diff: fpdfsdk/fsdk_actionhandler.cpp

Issue 1867183002: Use std::vector as internal storage for CPDF_Array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/include/fsdk_actionhandler.h" 7 #include "fpdfsdk/include/fsdk_actionhandler.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 CPDF_Dest MyDest = action.GetDest(pPDFDocument); 433 CPDF_Dest MyDest = action.GetDest(pPDFDocument);
434 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); 434 int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
435 int nFitType = MyDest.GetZoomMode(); 435 int nFitType = MyDest.GetZoomMode();
436 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject()); 436 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
437 float* pPosAry = nullptr; 437 float* pPosAry = nullptr;
438 int sizeOfAry = 0; 438 int sizeOfAry = 0;
439 if (pMyArray) { 439 if (pMyArray) {
440 pPosAry = new float[pMyArray->GetCount()]; 440 pPosAry = new float[pMyArray->GetCount()];
441 int j = 0; 441 int j = 0;
442 for (int i = 2; i < (int)pMyArray->GetCount(); i++) { 442 for (size_t i = 2; i < pMyArray->GetCount(); i++) {
443 pPosAry[j++] = pMyArray->GetFloatAt(i); 443 pPosAry[j++] = pMyArray->GetFloatAt(i);
444 } 444 }
445 sizeOfAry = j; 445 sizeOfAry = j;
446 } 446 }
447 447
448 CPDFDoc_Environment* pApp = pDocument->GetEnv(); 448 CPDFDoc_Environment* pApp = pDocument->GetEnv();
449 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry); 449 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
450 delete[] pPosAry; 450 delete[] pPosAry;
451 } 451 }
452 452
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 const CPDF_Action& action, 631 const CPDF_Action& action,
632 CPDFSDK_Document* pDocument) { 632 CPDFSDK_Document* pDocument) {
633 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 633 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
634 if (pInterForm->DoAction_ImportData(action)) { 634 if (pInterForm->DoAction_ImportData(action)) {
635 pDocument->SetChangeMark(); 635 pDocument->SetChangeMark();
636 return TRUE; 636 return TRUE;
637 } 637 }
638 638
639 return FALSE; 639 return FALSE;
640 } 640 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698