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

Side by Side 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 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 memset(&unsuppored_info, '\0', sizeof(unsuppored_info)); 604 memset(&unsuppored_info, '\0', sizeof(unsuppored_info));
605 unsuppored_info.version = 1; 605 unsuppored_info.version = 1;
606 unsuppored_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler; 606 unsuppored_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler;
607 607
608 FSDK_SetUnSpObjProcessHandler(&unsuppored_info); 608 FSDK_SetUnSpObjProcessHandler(&unsuppored_info);
609 609
610 while (!files.empty()) { 610 while (!files.empty()) {
611 std::string filename = files.front(); 611 std::string filename = files.front();
612 files.pop_front(); 612 files.pop_front();
613 size_t file_length = 0; 613 size_t file_length = 0;
614 char* file_contents = GetFileContents(filename.c_str(), &file_length); 614 std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
615 if (!file_contents) 615 GetFileContents(filename.c_str(), &file_length);
616 continue; 616 if (file_contents)
617 RenderPdf(filename, file_contents, file_length, options); 617 RenderPdf(filename, file_contents.get(), file_length, options);
618 free(file_contents);
619 } 618 }
620 619
621 FPDF_DestroyLibrary(); 620 FPDF_DestroyLibrary();
622 #ifdef PDF_ENABLE_V8 621 #ifdef PDF_ENABLE_V8
623 v8::V8::ShutdownPlatform(); 622 v8::V8::ShutdownPlatform();
624 delete platform; 623 delete platform;
625 #endif // PDF_ENABLE_V8 624 #endif // PDF_ENABLE_V8
626 625
627 return 0; 626 return 0;
628 } 627 }
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