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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 static bool GetExternalData(const Options& options, | 98 static bool GetExternalData(const Options& options, |
99 const std::string& bin_filename, | 99 const std::string& bin_filename, |
100 v8::StartupData* result_data) { | 100 v8::StartupData* result_data) { |
101 std::string full_path = GetFullPathForSnapshotFile(options, bin_filename); | 101 std::string full_path = GetFullPathForSnapshotFile(options, bin_filename); |
102 size_t data_length = 0; | 102 size_t data_length = 0; |
103 char* data_buffer = GetFileContents(full_path.c_str(), &data_length); | 103 char* data_buffer = GetFileContents(full_path.c_str(), &data_length); |
104 if (!data_buffer) { | 104 if (!data_buffer) { |
105 return false; | 105 return false; |
106 } | 106 } |
107 result_data->data = const_cast<const char*>(data_buffer); | 107 result_data->data = const_cast<const char*>(data_buffer); |
108 result_data->raw_size = data_length; | 108 result_data->raw_size = static_cast<int>(data_length); |
109 return true; | 109 return true; |
110 } | 110 } |
111 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 111 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
112 | 112 |
113 static void WritePpm(const char* pdf_name, int num, const void* buffer_void, | 113 static void WritePpm(const char* pdf_name, int num, const void* buffer_void, |
114 int stride, int width, int height) { | 114 int stride, int width, int height) { |
115 const char* buffer = reinterpret_cast<const char*>(buffer_void); | 115 const char* buffer = reinterpret_cast<const char*>(buffer_void); |
116 | 116 |
117 if (stride < 0 || width < 0 || height < 0) | 117 if (stride < 0 || width < 0 || height < 0) |
118 return; | 118 return; |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 if (!file_contents) | 510 if (!file_contents) |
511 continue; | 511 continue; |
512 RenderPdf(filename, file_contents, file_length, options.output_format); | 512 RenderPdf(filename, file_contents, file_length, options.output_format); |
513 free(file_contents); | 513 free(file_contents); |
514 } | 514 } |
515 | 515 |
516 FPDF_DestroyLibrary(); | 516 FPDF_DestroyLibrary(); |
517 | 517 |
518 return 0; | 518 return 0; |
519 } | 519 } |
OLD | NEW |