Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: fpdfsdk/src/fpdfdoc_embeddertest.cpp

Issue 1564583004: Merge to XFA: Return unique_ptrs from test_support functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/src/fpdftext_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index 260f25f3099958afd12665a33ba3b9d228c7690b..1c66a15bad98338acb301184c463342f43b76d3f 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -106,8 +106,9 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
EXPECT_TRUE(OpenDocument("bookmarks.pdf"));
// Find the first one, based on its known title.
- FPDF_WIDESTRING title = GetFPDFWideString(L"A Good Beginning");
- FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title);
+ std::unique_ptr<unsigned short, pdfium::FreeDeleter> title =
+ GetFPDFWideString(L"A Good Beginning");
+ FPDF_BOOKMARK child = FPDFBookmark_Find(document(), title.get());
EXPECT_NE(nullptr, child);
// Check that the string matches.
@@ -120,10 +121,7 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr));
// Try to find one using a non-existent title.
- FPDF_WIDESTRING bad_title = GetFPDFWideString(L"A BAD Beginning");
- EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), bad_title));
-
- // Alas, the typedef includes the "const".
- free(const_cast<unsigned short*>(title));
- free(const_cast<unsigned short*>(bad_title));
+ std::unique_ptr<unsigned short, pdfium::FreeDeleter> bad_title =
+ GetFPDFWideString(L"A BAD Beginning");
+ EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), bad_title.get()));
}
« no previous file with comments | « no previous file | fpdfsdk/src/fpdftext_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698