summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-31 02:33:27 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-31 16:41:19 +0000
commitdf064df7a08e008b3c8e4d56bb0b75da9f014147 (patch)
tree17f7244a29424c5e61460ed672b2f25df1278b14 /samples
parent63b012652da22f75172895a975ea7932e63dcc81 (diff)
downloadpdfium-df064df7a08e008b3c8e4d56bb0b75da9f014147.tar.xz
Change APIs to use FPDF_BYTESTRING for keys.
Change-Id: I865a9eeb197ea2c1f5480cae32d975909495676d Reviewed-on: https://pdfium-review.googlesource.com/12551 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test.cc14
1 files changed, 6 insertions, 8 deletions
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<unsigned short, pdfium::FreeDeleter> 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<char> 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<unsigned short*>(buf.data()))
.c_str());
- std::unique_ptr<unsigned short, pdfium::FreeDeleter> 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<unsigned short*>(buf.data()))
.c_str());