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

Unified Diff: samples/pdfium_test.cc

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 | « fpdfsdk/src/fpdftext_embeddertest.cpp ('k') | testing/embedder_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 6bf1ec18cea6ed8a88f81a3f40719045b504db2c..dbd91c31da2f90e643e4e3d3231bea8d5883c885 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -611,11 +611,10 @@ int main(int argc, const char* argv[]) {
std::string filename = files.front();
files.pop_front();
size_t file_length = 0;
- char* file_contents = GetFileContents(filename.c_str(), &file_length);
- if (!file_contents)
- continue;
- RenderPdf(filename, file_contents, file_length, options);
- free(file_contents);
+ std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
+ GetFileContents(filename.c_str(), &file_length);
+ if (file_contents)
+ RenderPdf(filename, file_contents.get(), file_length, options);
}
FPDF_DestroyLibrary();
« no previous file with comments | « fpdfsdk/src/fpdftext_embeddertest.cpp ('k') | testing/embedder_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698