From df064df7a08e008b3c8e4d56bb0b75da9f014147 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 31 Aug 2017 02:33:27 -0700 Subject: Change APIs to use FPDF_BYTESTRING for keys. Change-Id: I865a9eeb197ea2c1f5480cae32d975909495676d Reviewed-on: https://pdfium-review.googlesource.com/12551 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- samples/pdfium_test.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index b94b674286..40f12a318b 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -395,21 +395,19 @@ void WriteAnnot(FPDF_PAGE page, const char* pdf_name, int num) { } // Retrieve the annotation's contents and author. - std::unique_ptr contents_key = - GetFPDFWideString(L"Contents"); + static constexpr char kContentsKey[] = "Contents"; + static constexpr char kAuthorKey[] = "T"; unsigned long len = - FPDFAnnot_GetStringValue(annot, contents_key.get(), nullptr, 0); + FPDFAnnot_GetStringValue(annot, kContentsKey, nullptr, 0); std::vector buf(len); - FPDFAnnot_GetStringValue(annot, contents_key.get(), buf.data(), len); + FPDFAnnot_GetStringValue(annot, kContentsKey, buf.data(), len); fprintf(fp, "Content: %ls\n", GetPlatformWString(reinterpret_cast(buf.data())) .c_str()); - std::unique_ptr author_key = - GetFPDFWideString(L"T"); - len = FPDFAnnot_GetStringValue(annot, author_key.get(), nullptr, 0); + len = FPDFAnnot_GetStringValue(annot, kAuthorKey, nullptr, 0); buf.clear(); buf.resize(len); - FPDFAnnot_GetStringValue(annot, author_key.get(), buf.data(), len); + FPDFAnnot_GetStringValue(annot, kAuthorKey, buf.data(), len); fprintf(fp, "Author: %ls\n", GetPlatformWString(reinterpret_cast(buf.data())) .c_str()); -- cgit v1.2.3