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

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

Issue 1411203007: Cleanup parts of CPDFSDK_AnnotIterator and CPDFSDK_PageView. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix bounds check 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 "../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../third_party/base/nonstd_unique_ptr.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fsdk_mgr.h" 9 #include "../include/fsdk_mgr.h"
10 #include "../include/fsdk_baseannot.h" 10 #include "../include/fsdk_baseannot.h"
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 if (rcAnnot1.top > rcAnnot2.top) 2456 if (rcAnnot1.top > rcAnnot2.top)
2457 return 1; 2457 return 1;
2458 return 0; 2458 return 0;
2459 } 2459 }
2460 2460
2461 void CBA_AnnotIterator::GenerateResults() { 2461 void CBA_AnnotIterator::GenerateResults() {
2462 ASSERT(m_pPageView != NULL); 2462 ASSERT(m_pPageView != NULL);
2463 2463
2464 switch (m_nTabs) { 2464 switch (m_nTabs) {
2465 case BAI_STRUCTURE: { 2465 case BAI_STRUCTURE: {
2466 for (int i = 0, sz = m_pPageView->CountAnnots(); i < sz; i++) { 2466 for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
2467 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); 2467 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
2468 ASSERT(pAnnot != NULL); 2468 ASSERT(pAnnot != NULL);
2469 2469
2470 if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType) 2470 if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType)
2471 m_Annots.Add(pAnnot); 2471 m_Annots.Add(pAnnot);
2472 } 2472 }
2473 } break; 2473 } break;
2474 case BAI_ROW: { 2474 case BAI_ROW: {
2475 CPDFSDK_SortAnnots sa; 2475 CPDFSDK_SortAnnots sa;
2476 2476
2477 { 2477 {
2478 for (int i = 0, sz = m_pPageView->CountAnnots(); i < sz; i++) { 2478 for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
2479 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); 2479 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
2480 ASSERT(pAnnot != NULL); 2480 ASSERT(pAnnot != NULL);
2481 2481
2482 if (pAnnot->GetType() == m_sType && 2482 if (pAnnot->GetType() == m_sType &&
2483 pAnnot->GetSubType() == m_sSubType) 2483 pAnnot->GetSubType() == m_sSubType)
2484 sa.Add(pAnnot); 2484 sa.Add(pAnnot);
2485 } 2485 }
2486 } 2486 }
2487 2487
2488 if (sa.GetSize() > 0) { 2488 if (sa.GetSize() > 0) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 2547
2548 aSelect.RemoveAll(); 2548 aSelect.RemoveAll();
2549 } 2549 }
2550 } 2550 }
2551 sa.RemoveAll(); 2551 sa.RemoveAll();
2552 } break; 2552 } break;
2553 case BAI_COLUMN: { 2553 case BAI_COLUMN: {
2554 CPDFSDK_SortAnnots sa; 2554 CPDFSDK_SortAnnots sa;
2555 2555
2556 { 2556 {
2557 for (int i = 0, sz = m_pPageView->CountAnnots(); i < sz; i++) { 2557 for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
2558 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i); 2558 CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
2559 ASSERT(pAnnot != NULL); 2559 ASSERT(pAnnot != NULL);
2560 2560
2561 if (pAnnot->GetType() == m_sType && 2561 if (pAnnot->GetType() == m_sType &&
2562 pAnnot->GetSubType() == m_sSubType) 2562 pAnnot->GetSubType() == m_sSubType)
2563 sa.Add(pAnnot); 2563 sa.Add(pAnnot);
2564 } 2564 }
2565 } 2565 }
2566 2566
2567 if (sa.GetSize() > 0) { 2567 if (sa.GetSize() > 0) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 ASSERT(pAnnot != NULL); 2639 ASSERT(pAnnot != NULL);
2640 2640
2641 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2641 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2642 ASSERT(pPDFAnnot != NULL); 2642 ASSERT(pPDFAnnot != NULL);
2643 2643
2644 CPDF_Rect rcAnnot; 2644 CPDF_Rect rcAnnot;
2645 pPDFAnnot->GetRect(rcAnnot); 2645 pPDFAnnot->GetRect(rcAnnot);
2646 2646
2647 return rcAnnot; 2647 return rcAnnot;
2648 } 2648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698