| 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 if (m_pObj == NULL || m_pObj->GetType() != PDFOBJ_ARRAY) { | 10 if (m_pObj == NULL || m_pObj->GetType() != PDFOBJ_ARRAY) { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, | 399 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, |
| 400 const CFX_WideStringC& wsFileName, | 400 const CFX_WideStringC& wsFileName, |
| 401 FX_BOOL bURL) { | 401 FX_BOOL bURL) { |
| 402 ASSERT(pObj != NULL); | 402 ASSERT(pObj != NULL); |
| 403 CFX_WideString wsStr; | 403 CFX_WideString wsStr; |
| 404 if (bURL) { | 404 if (bURL) { |
| 405 wsStr = wsFileName; | 405 wsStr = wsFileName; |
| 406 } else { | 406 } else { |
| 407 wsStr = FILESPEC_EncodeFileName(wsFileName); | 407 wsStr = FILESPEC_EncodeFileName(wsFileName); |
| 408 } | 408 } |
| 409 int32_t iType = pObj->GetType(); | 409 if (pObj->IsString()) { |
| 410 if (iType == PDFOBJ_STRING) { | |
| 411 pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); | 410 pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); |
| 412 } else if (CPDF_Dictionary* pDict = pObj->AsDictionary()) { | 411 } else if (CPDF_Dictionary* pDict = pObj->AsDictionary()) { |
| 413 pDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(wsStr)); | 412 pDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(wsStr)); |
| 414 pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr)); | 413 pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr)); |
| 415 } | 414 } |
| 416 } | 415 } |
| 417 void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, | 416 void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, |
| 418 FX_BOOL bURL) { | 417 FX_BOOL bURL) { |
| 419 ASSERT(m_pObj != NULL); | 418 ASSERT(m_pObj != NULL); |
| 420 if (bURL) { | 419 if (bURL) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 int nPage = FXSYS_atoi(bsLbl); | 536 int nPage = FXSYS_atoi(bsLbl); |
| 538 if (nPage > 0 && nPage <= nPages) { | 537 if (nPage > 0 && nPage <= nPages) { |
| 539 return nPage; | 538 return nPage; |
| 540 } | 539 } |
| 541 return -1; | 540 return -1; |
| 542 } | 541 } |
| 543 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 542 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
| 544 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); | 543 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); |
| 545 return GetPageByLabel(bsLabel); | 544 return GetPageByLabel(bsLabel); |
| 546 } | 545 } |
| OLD | NEW |