| 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 "../../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 CPDF_Array* pArray = ToArray(m_pObj); | 10 CPDF_Array* pArray = ToArray(m_pObj); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 result = '/'; | 373 result = '/'; |
| 374 result += ChangeSlashToPDF(filepath.GetPtr()); | 374 result += ChangeSlashToPDF(filepath.GetPtr()); |
| 375 return result; | 375 return result; |
| 376 } | 376 } |
| 377 return ChangeSlashToPDF(filepath.GetPtr()); | 377 return ChangeSlashToPDF(filepath.GetPtr()); |
| 378 #else | 378 #else |
| 379 return filepath; | 379 return filepath; |
| 380 #endif | 380 #endif |
| 381 } | 381 } |
| 382 CPDF_Stream* CPDF_FileSpec::GetFileStream() const { | 382 CPDF_Stream* CPDF_FileSpec::GetFileStream() const { |
| 383 if (m_pObj == NULL) { | 383 if (!m_pObj) |
| 384 return NULL; | 384 return nullptr; |
| 385 } | 385 if (CPDF_Stream* pStream = m_pObj->AsStream()) |
| 386 int32_t iType = m_pObj->GetType(); | 386 return pStream; |
| 387 if (iType == PDFOBJ_STREAM) | |
| 388 return (CPDF_Stream*)m_pObj; | |
| 389 if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict(FX_BSTRC("EF"))) | 387 if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict(FX_BSTRC("EF"))) |
| 390 return pEF->GetStream(FX_BSTRC("F")); | 388 return pEF->GetStream(FX_BSTRC("F")); |
| 391 return NULL; | 389 return nullptr; |
| 392 } | 390 } |
| 393 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, | 391 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, |
| 394 const CFX_WideStringC& wsFileName, | 392 const CFX_WideStringC& wsFileName, |
| 395 FX_BOOL bURL) { | 393 FX_BOOL bURL) { |
| 396 ASSERT(pObj != NULL); | 394 ASSERT(pObj != NULL); |
| 397 CFX_WideString wsStr; | 395 CFX_WideString wsStr; |
| 398 if (bURL) { | 396 if (bURL) { |
| 399 wsStr = wsFileName; | 397 wsStr = wsFileName; |
| 400 } else { | 398 } else { |
| 401 wsStr = FILESPEC_EncodeFileName(wsFileName); | 399 wsStr = FILESPEC_EncodeFileName(wsFileName); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 int nPage = FXSYS_atoi(bsLbl); | 528 int nPage = FXSYS_atoi(bsLbl); |
| 531 if (nPage > 0 && nPage <= nPages) { | 529 if (nPage > 0 && nPage <= nPages) { |
| 532 return nPage; | 530 return nPage; |
| 533 } | 531 } |
| 534 return -1; | 532 return -1; |
| 535 } | 533 } |
| 536 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 534 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
| 537 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); | 535 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); |
| 538 return GetPageByLabel(bsLabel); | 536 return GetPageByLabel(bsLabel); |
| 539 } | 537 } |
| OLD | NEW |