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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 printf("Unsupported feature: %s.\n", feature.c_str()); | 262 printf("Unsupported feature: %s.\n", feature.c_str()); |
263 } | 263 } |
264 | 264 |
265 bool ParseCommandLine(const std::vector<std::string>& args, | 265 bool ParseCommandLine(const std::vector<std::string>& args, |
266 Options* options, std::list<std::string>* files) { | 266 Options* options, std::list<std::string>* files) { |
267 if (args.empty()) { | 267 if (args.empty()) { |
268 return false; | 268 return false; |
269 } | 269 } |
270 options->exe_path = args[0]; | 270 options->exe_path = args[0]; |
271 int cur_idx = 1; | 271 size_t cur_idx = 1; |
272 for (; cur_idx < args.size(); ++cur_idx) { | 272 for (; cur_idx < args.size(); ++cur_idx) { |
273 const std::string& cur_arg = args[cur_idx]; | 273 const std::string& cur_arg = args[cur_idx]; |
274 if (cur_arg == "--ppm") { | 274 if (cur_arg == "--ppm") { |
275 if (options->output_format != OUTPUT_NONE) { | 275 if (options->output_format != OUTPUT_NONE) { |
276 fprintf(stderr, "Duplicate or conflicting --ppm argument\n"); | 276 fprintf(stderr, "Duplicate or conflicting --ppm argument\n"); |
277 return false; | 277 return false; |
278 } | 278 } |
279 options->output_format = OUTPUT_PPM; | 279 options->output_format = OUTPUT_PPM; |
280 } | 280 } |
281 #ifdef _WIN32 | 281 #ifdef _WIN32 |
(...skipping 21 matching lines...) Expand all Loading... |
303 options->bin_directory = cur_arg.substr(10); | 303 options->bin_directory = cur_arg.substr(10); |
304 } | 304 } |
305 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 305 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
306 else | 306 else |
307 break; | 307 break; |
308 } | 308 } |
309 if (cur_idx >= args.size()) { | 309 if (cur_idx >= args.size()) { |
310 fprintf(stderr, "No input files.\n"); | 310 fprintf(stderr, "No input files.\n"); |
311 return false; | 311 return false; |
312 } | 312 } |
313 for (int i = cur_idx; i < args.size(); i++) { | 313 for (size_t i = cur_idx; i < args.size(); i++) { |
314 files->push_back(args[i]); | 314 files->push_back(args[i]); |
315 } | 315 } |
316 return true; | 316 return true; |
317 } | 317 } |
318 | 318 |
319 class TestLoader { | 319 class TestLoader { |
320 public: | 320 public: |
321 TestLoader(const char* pBuf, size_t len); | 321 TestLoader(const char* pBuf, size_t len); |
322 | 322 |
323 const char* m_pBuf; | 323 const char* m_pBuf; |
(...skipping 186 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 |