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

Side by Side Diff: fpdfsdk/src/fsdk_actionhandler.cpp

Issue 1417893003: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_actionhandler.h" 9 #include "../include/fsdk_actionhandler.h"
10 #include "../include/javascript/IJavaScript.h" 10 #include "../include/javascript/IJavaScript.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 case CPDF_Action::Trans: 418 case CPDF_Action::Trans:
419 break; 419 break;
420 case CPDF_Action::GoTo3DView: 420 case CPDF_Action::GoTo3DView:
421 break; 421 break;
422 default: 422 default:
423 break; 423 break;
424 } 424 }
425 } 425 }
426 426
427 FX_BOOL CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument) { 427 FX_BOOL CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument) {
428 ASSERT(pDocument != NULL); 428 ASSERT(pDocument);
429 return TRUE; 429 return TRUE;
430 } 430 }
431 431
432 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, 432 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
433 const CPDF_Action& action) { 433 const CPDF_Action& action) {
434 ASSERT(action); 434 ASSERT(action);
435 435
436 CPDF_Document* pPDFDocument = pDocument->GetDocument(); 436 CPDF_Document* pPDFDocument = pDocument->GetDocument();
437 ASSERT(pPDFDocument != NULL); 437 ASSERT(pPDFDocument);
Lei Zhang 2015/10/21 21:44:09 Don't bother keeping ones where it dereferences th
dsinclair 2015/10/22 13:31:12 Removed the assert for pApp, left the one for pPDF
438 CPDFDoc_Environment* pApp = pDocument->GetEnv(); 438 CPDFDoc_Environment* pApp = pDocument->GetEnv();
439 ASSERT(pApp != NULL); 439 ASSERT(pApp);
440 440
441 CPDF_Dest MyDest = action.GetDest(pPDFDocument); 441 CPDF_Dest MyDest = action.GetDest(pPDFDocument);
442 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); 442 int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
443 int nFitType = MyDest.GetZoomMode(); 443 int nFitType = MyDest.GetZoomMode();
444 const CPDF_Array* pMyArray = (CPDF_Array*)MyDest.GetObject(); 444 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
445 float* pPosAry = NULL; 445 float* pPosAry = nullptr;
446 int sizeOfAry = 0; 446 int sizeOfAry = 0;
447 if (pMyArray != NULL) { 447 if (pMyArray) {
448 pPosAry = new float[pMyArray->GetCount()]; 448 pPosAry = new float[pMyArray->GetCount()];
449 int j = 0; 449 int j = 0;
450 for (int i = 2; i < (int)pMyArray->GetCount(); i++) { 450 for (int i = 2; i < (int)pMyArray->GetCount(); i++) {
451 pPosAry[j++] = pMyArray->GetFloat(i); 451 pPosAry[j++] = pMyArray->GetFloat(i);
452 } 452 }
453 sizeOfAry = j; 453 sizeOfAry = j;
454 } 454 }
455 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry); 455 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
456 delete[] pPosAry; 456 delete[] pPosAry;
457 } 457 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 678 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
679 ASSERT(pInterForm != NULL); 679 ASSERT(pInterForm != NULL);
680 680
681 if (pInterForm->DoAction_ImportData(action)) { 681 if (pInterForm->DoAction_ImportData(action)) {
682 pDocument->SetChangeMark(); 682 pDocument->SetChangeMark();
683 return TRUE; 683 return TRUE;
684 } 684 }
685 685
686 return FALSE; 686 return FALSE;
687 } 687 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698