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

Side by Side Diff: samples/pdfium_test.cc

Issue 1563513002: Return unique_ptrs from test_support functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: namespace pdfium 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdftext_embeddertest.cpp ('k') | testing/embedder_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> 5 #include <limits.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 memset(&unsuppored_info, '\0', sizeof(unsuppored_info)); 583 memset(&unsuppored_info, '\0', sizeof(unsuppored_info));
584 unsuppored_info.version = 1; 584 unsuppored_info.version = 1;
585 unsuppored_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler; 585 unsuppored_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler;
586 586
587 FSDK_SetUnSpObjProcessHandler(&unsuppored_info); 587 FSDK_SetUnSpObjProcessHandler(&unsuppored_info);
588 588
589 while (!files.empty()) { 589 while (!files.empty()) {
590 std::string filename = files.front(); 590 std::string filename = files.front();
591 files.pop_front(); 591 files.pop_front();
592 size_t file_length = 0; 592 size_t file_length = 0;
593 char* file_contents = GetFileContents(filename.c_str(), &file_length); 593 std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
594 if (!file_contents) 594 GetFileContents(filename.c_str(), &file_length);
595 continue; 595 if (file_contents)
596 RenderPdf(filename, file_contents, file_length, options); 596 RenderPdf(filename, file_contents.get(), file_length, options);
597 free(file_contents);
598 } 597 }
599 598
600 FPDF_DestroyLibrary(); 599 FPDF_DestroyLibrary();
601 #ifdef PDF_ENABLE_V8 600 #ifdef PDF_ENABLE_V8
602 v8::V8::ShutdownPlatform(); 601 v8::V8::ShutdownPlatform();
603 delete platform; 602 delete platform;
604 #endif // PDF_ENABLE_V8 603 #endif // PDF_ENABLE_V8
605 604
606 return 0; 605 return 0;
607 } 606 }
OLDNEW
« 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