| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |