| 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 result += filepath.GetAt(1); | 308 result += filepath.GetAt(1); |
| 309 result += ':'; | 309 result += ':'; |
| 310 result += ChangeSlashToPlatform(filepath.c_str() + 2); | 310 result += ChangeSlashToPlatform(filepath.c_str() + 2); |
| 311 return result; | 311 return result; |
| 312 } | 312 } |
| 313 CFX_WideString result; | 313 CFX_WideString result; |
| 314 result += '\\'; | 314 result += '\\'; |
| 315 result += ChangeSlashToPlatform(filepath.c_str()); | 315 result += ChangeSlashToPlatform(filepath.c_str()); |
| 316 return result; | 316 return result; |
| 317 #else | 317 #else |
| 318 return filepath; | 318 return CFX_WideString(filepath); |
| 319 #endif | 319 #endif |
| 320 } | 320 } |
| 321 | 321 |
| 322 bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { | 322 bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { |
| 323 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { | 323 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { |
| 324 *csFileName = pDict->GetUnicodeTextBy("UF"); | 324 *csFileName = pDict->GetUnicodeTextBy("UF"); |
| 325 if (csFileName->IsEmpty()) { | 325 if (csFileName->IsEmpty()) { |
| 326 *csFileName = | 326 *csFileName = |
| 327 CFX_WideString::FromLocal(pDict->GetStringBy("F").AsStringC()); | 327 CFX_WideString::FromLocal(pDict->GetStringBy("F").AsStringC()); |
| 328 } | 328 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return ChangeSlashToPDF(filepath.c_str()); | 383 return ChangeSlashToPDF(filepath.c_str()); |
| 384 #elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 384 #elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 385 if (filepath.Left(sizeof("Mac") - 1) == FX_WSTRC(L"Mac")) { | 385 if (filepath.Left(sizeof("Mac") - 1) == FX_WSTRC(L"Mac")) { |
| 386 CFX_WideString result; | 386 CFX_WideString result; |
| 387 result = '/'; | 387 result = '/'; |
| 388 result += ChangeSlashToPDF(filepath.c_str()); | 388 result += ChangeSlashToPDF(filepath.c_str()); |
| 389 return result; | 389 return result; |
| 390 } | 390 } |
| 391 return ChangeSlashToPDF(filepath.c_str()); | 391 return ChangeSlashToPDF(filepath.c_str()); |
| 392 #else | 392 #else |
| 393 return filepath; | 393 return CFX_WideString(filepath); |
| 394 #endif | 394 #endif |
| 395 } | 395 } |
| 396 | 396 |
| 397 void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName) { | 397 void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName) { |
| 398 if (!m_pObj) | 398 if (!m_pObj) |
| 399 return; | 399 return; |
| 400 | 400 |
| 401 CFX_WideString wsStr = EncodeFileName(wsFileName); | 401 CFX_WideString wsStr = EncodeFileName(wsFileName); |
| 402 if (m_pObj->IsString()) { | 402 if (m_pObj->IsString()) { |
| 403 m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); | 403 m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 bsLbl = bsOrig; | 520 bsLbl = bsOrig; |
| 521 int nPage = FXSYS_atoi(bsLbl.c_str()); | 521 int nPage = FXSYS_atoi(bsLbl.c_str()); |
| 522 if (nPage > 0 && nPage <= nPages) { | 522 if (nPage > 0 && nPage <= nPages) { |
| 523 return nPage; | 523 return nPage; |
| 524 } | 524 } |
| 525 return -1; | 525 return -1; |
| 526 } | 526 } |
| 527 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 527 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
| 528 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); | 528 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); |
| 529 } | 529 } |
| OLD | NEW |