| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 return result; | 308 return result; |
| 309 #else | 309 #else |
| 310 return filepath; | 310 return filepath; |
| 311 #endif | 311 #endif |
| 312 } | 312 } |
| 313 | 313 |
| 314 bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { | 314 bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { |
| 315 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { | 315 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { |
| 316 *csFileName = pDict->GetUnicodeTextBy("UF"); | 316 *csFileName = pDict->GetUnicodeTextBy("UF"); |
| 317 if (csFileName->IsEmpty()) { | 317 if (csFileName->IsEmpty()) { |
| 318 *csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F")); | 318 *csFileName = CFX_WideString::FromLocal(pDict->GetConstStringBy("F")); |
| 319 } | 319 } |
| 320 if (pDict->GetStringBy("FS") == "URL") | 320 if (pDict->GetStringBy("FS") == "URL") |
| 321 return true; | 321 return true; |
| 322 if (csFileName->IsEmpty()) { | 322 if (csFileName->IsEmpty()) { |
| 323 if (pDict->KeyExist("DOS")) { | 323 if (pDict->KeyExist("DOS")) { |
| 324 *csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS")); | 324 *csFileName = CFX_WideString::FromLocal( |
| 325 pDict->GetStringBy("DOS").AsByteStringC()); |
| 325 } else if (pDict->KeyExist("Mac")) { | 326 } else if (pDict->KeyExist("Mac")) { |
| 326 *csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Mac")); | 327 *csFileName = CFX_WideString::FromLocal( |
| 328 pDict->GetStringBy("Mac").AsByteStringC()); |
| 327 } else if (pDict->KeyExist("Unix")) { | 329 } else if (pDict->KeyExist("Unix")) { |
| 328 *csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Unix")); | 330 *csFileName = CFX_WideString::FromLocal( |
| 331 pDict->GetStringBy("Unix").AsByteStringC()); |
| 329 } else { | 332 } else { |
| 330 return false; | 333 return false; |
| 331 } | 334 } |
| 332 } | 335 } |
| 333 } else if (m_pObj->IsString()) { | 336 } else if (m_pObj->IsString()) { |
| 334 *csFileName = CFX_WideString::FromLocal(m_pObj->GetString()); | 337 *csFileName = |
| 338 CFX_WideString::FromLocal(m_pObj->GetString().AsByteStringC()); |
| 335 } else { | 339 } else { |
| 336 return false; | 340 return false; |
| 337 } | 341 } |
| 338 *csFileName = DecodeFileName(csFileName->AsWideStringC()); | 342 *csFileName = DecodeFileName(csFileName->AsWideStringC()); |
| 339 return true; | 343 return true; |
| 340 } | 344 } |
| 341 | 345 |
| 342 CPDF_FileSpec::CPDF_FileSpec() { | 346 CPDF_FileSpec::CPDF_FileSpec() { |
| 343 m_pObj = new CPDF_Dictionary; | 347 m_pObj = new CPDF_Dictionary; |
| 344 m_pObj->AsDictionary()->SetAtName("Type", "Filespec"); | 348 m_pObj->AsDictionary()->SetAtName("Type", "Filespec"); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 bsLbl = bsOrig; | 512 bsLbl = bsOrig; |
| 509 int nPage = FXSYS_atoi(bsLbl); | 513 int nPage = FXSYS_atoi(bsLbl); |
| 510 if (nPage > 0 && nPage <= nPages) { | 514 if (nPage > 0 && nPage <= nPages) { |
| 511 return nPage; | 515 return nPage; |
| 512 } | 516 } |
| 513 return -1; | 517 return -1; |
| 514 } | 518 } |
| 515 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 519 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
| 516 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsByteStringC()); | 520 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsByteStringC()); |
| 517 } | 521 } |
| OLD | NEW |