OLD | NEW |
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 "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
9 #include "core/fpdfdoc/doc_utils.h" | 9 #include "core/fpdfdoc/doc_utils.h" |
10 #include "core/fpdfdoc/include/fpdf_doc.h" | 10 #include "core/fpdfdoc/include/fpdf_doc.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 int nPages = m_pDocument->GetPageCount(); | 504 int nPages = m_pDocument->GetPageCount(); |
505 CFX_ByteString bsLbl; | 505 CFX_ByteString bsLbl; |
506 CFX_ByteString bsOrig = bsLabel; | 506 CFX_ByteString bsOrig = bsLabel; |
507 for (int i = 0; i < nPages; i++) { | 507 for (int i = 0; i < nPages; i++) { |
508 bsLbl = PDF_EncodeText(GetLabel(i)); | 508 bsLbl = PDF_EncodeText(GetLabel(i)); |
509 if (!bsLbl.Compare(bsOrig.AsStringC())) { | 509 if (!bsLbl.Compare(bsOrig.AsStringC())) { |
510 return i; | 510 return i; |
511 } | 511 } |
512 } | 512 } |
513 bsLbl = bsOrig; | 513 bsLbl = bsOrig; |
514 int nPage = FXSYS_atoi(bsLbl); | 514 int nPage = FXSYS_atoi(bsLbl.c_str()); |
515 if (nPage > 0 && nPage <= nPages) { | 515 if (nPage > 0 && nPage <= nPages) { |
516 return nPage; | 516 return nPage; |
517 } | 517 } |
518 return -1; | 518 return -1; |
519 } | 519 } |
520 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 520 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
521 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); | 521 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); |
522 } | 522 } |
OLD | NEW |