OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |