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 "public/fpdf_doc.h" | 7 #include "public/fpdf_doc.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 389 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
390 if (!pDoc) | 390 if (!pDoc) |
391 return 0; | 391 return 0; |
392 CPDF_Dictionary* pInfo = pDoc->GetInfo(); | 392 CPDF_Dictionary* pInfo = pDoc->GetInfo(); |
393 if (!pInfo) | 393 if (!pInfo) |
394 return 0; | 394 return 0; |
395 CFX_WideString text = pInfo->GetUnicodeTextFor(tag); | 395 CFX_WideString text = pInfo->GetUnicodeTextFor(tag); |
396 return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen); | 396 return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen); |
397 } | 397 } |
398 | 398 |
399 DLLEXPORT unsigned long STDCALL FPDF_GetPagelLabel(FPDF_DOCUMENT document, | 399 DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document, |
400 int page_index, | 400 int page_index, |
401 void* buffer, | 401 void* buffer, |
402 unsigned long buflen) { | 402 unsigned long buflen) { |
403 if (page_index < 0) | 403 if (page_index < 0) |
404 return 0; | 404 return 0; |
405 | 405 |
406 // CPDF_PageLabel can deal with NULL |document|. | 406 // CPDF_PageLabel can deal with NULL |document|. |
407 CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document)); | 407 CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document)); |
408 CFX_WideString str; | 408 CFX_WideString str; |
409 if (!label.GetLabel(page_index, &str)) | 409 if (!label.GetLabel(page_index, &str)) |
410 return 0; | 410 return 0; |
411 return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen); | 411 return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen); |
412 } | 412 } |
OLD | NEW |