summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
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());