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

Side by Side Diff: core/src/fpdfdoc/doc_basic.cpp

Issue 1114313006: Make constructors recognize char[n] vs. char* and avoid strlen calls. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Delegated constructors everywhere. Created 5 years, 7 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/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 const int nMaxRecursion = 32; 8 const int nMaxRecursion = 32;
9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) 9 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc)
10 { 10 {
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 523 }
524 n--; 524 n--;
525 } 525 }
526 if (pValue != NULL) { 526 if (pValue != NULL) {
527 pValue = pValue->GetDirect(); 527 pValue = pValue->GetDirect();
528 if (pValue->GetType() == PDFOBJ_DICTIONARY) { 528 if (pValue->GetType() == PDFOBJ_DICTIONARY) {
529 CPDF_Dictionary* pLabel = (CPDF_Dictionary*)pValue; 529 CPDF_Dictionary* pLabel = (CPDF_Dictionary*)pValue;
530 if (pLabel->KeyExist(FX_BSTRC("P"))) { 530 if (pLabel->KeyExist(FX_BSTRC("P"))) {
531 wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P")); 531 wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P"));
532 } 532 }
533 CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), N ULL); 533 CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), C FX_ByteStringC());
534 int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1); 534 int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1);
535 CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumbe ringStyle); 535 CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumbe ringStyle);
536 wsLabel += wsNumPortion; 536 wsLabel += wsNumPortion;
537 return wsLabel; 537 return wsLabel;
538 } 538 }
539 } 539 }
540 wsLabel.Format(L"%d", nPage + 1); 540 wsLabel.Format(L"%d", nPage + 1);
541 return wsLabel; 541 return wsLabel;
542 } 542 }
543 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const 543 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const
(...skipping 19 matching lines...) Expand all
563 if (nPage > 0 && nPage <= nPages) { 563 if (nPage > 0 && nPage <= nPages) {
564 return nPage; 564 return nPage;
565 } 565 }
566 return -1; 566 return -1;
567 } 567 }
568 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const 568 FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const
569 { 569 {
570 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); 570 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr());
571 return GetPageByLabel(bsLabel); 571 return GetPageByLabel(bsLabel);
572 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698