| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return false; | 319 return false; |
| 320 } | 320 } |
| 321 options->output_format = OUTPUT_PNG; | 321 options->output_format = OUTPUT_PNG; |
| 322 } else if (cur_arg.size() > 11 && | 322 } else if (cur_arg.size() > 11 && |
| 323 cur_arg.compare(0, 11, "--font-dir=") == 0) { | 323 cur_arg.compare(0, 11, "--font-dir=") == 0) { |
| 324 if (!options->font_directory.empty()) { | 324 if (!options->font_directory.empty()) { |
| 325 fprintf(stderr, "Duplicate --font-dir argument\n"); | 325 fprintf(stderr, "Duplicate --font-dir argument\n"); |
| 326 return false; | 326 return false; |
| 327 } | 327 } |
| 328 options->font_directory = cur_arg.substr(11); | 328 options->font_directory = cur_arg.substr(11); |
| 329 } | |
| 330 #ifdef _WIN32 | 329 #ifdef _WIN32 |
| 331 else if (cur_arg == "--emf") { | 330 } else if (cur_arg == "--emf") { |
| 332 if (options->output_format != OUTPUT_NONE) { | 331 if (options->output_format != OUTPUT_NONE) { |
| 333 fprintf(stderr, "Duplicate or conflicting --emf argument\n"); | 332 fprintf(stderr, "Duplicate or conflicting --emf argument\n"); |
| 334 return false; | 333 return false; |
| 335 } | 334 } |
| 336 options->output_format = OUTPUT_EMF; | 335 options->output_format = OUTPUT_EMF; |
| 337 } else if (cur_arg == "--bmp") { | 336 } else if (cur_arg == "--bmp") { |
| 338 if (options->output_format != OUTPUT_NONE) { | 337 if (options->output_format != OUTPUT_NONE) { |
| 339 fprintf(stderr, "Duplicate or conflicting --bmp argument\n"); | 338 fprintf(stderr, "Duplicate or conflicting --bmp argument\n"); |
| 340 return false; | 339 return false; |
| 341 } | 340 } |
| 342 options->output_format = OUTPUT_BMP; | 341 options->output_format = OUTPUT_BMP; |
| 343 } | |
| 344 #endif // _WIN32 | 342 #endif // _WIN32 |
| 343 |
| 345 #ifdef PDF_ENABLE_V8 | 344 #ifdef PDF_ENABLE_V8 |
| 346 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 345 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 347 else if (cur_arg.size() > 10 && cur_arg.compare(0, 10, "--bin-dir=") == 0) { | 346 } else if (cur_arg.size() > 10 && |
| 347 cur_arg.compare(0, 10, "--bin-dir=") == 0) { |
| 348 if (!options->bin_directory.empty()) { | 348 if (!options->bin_directory.empty()) { |
| 349 fprintf(stderr, "Duplicate --bin-dir argument\n"); | 349 fprintf(stderr, "Duplicate --bin-dir argument\n"); |
| 350 return false; | 350 return false; |
| 351 } | 351 } |
| 352 options->bin_directory = cur_arg.substr(10); | 352 options->bin_directory = cur_arg.substr(10); |
| 353 } | |
| 354 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 353 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 355 #endif // PDF_ENABLE_V8 | 354 #endif // PDF_ENABLE_V8 |
| 356 else if (cur_arg.size() > 8 && cur_arg.compare(0, 8, "--scale=") == 0) { | 355 |
| 356 } else if (cur_arg.size() > 8 && cur_arg.compare(0, 8, "--scale=") == 0) { |
| 357 if (!options->scale_factor_as_string.empty()) { | 357 if (!options->scale_factor_as_string.empty()) { |
| 358 fprintf(stderr, "Duplicate --scale argument\n"); | 358 fprintf(stderr, "Duplicate --scale argument\n"); |
| 359 return false; | 359 return false; |
| 360 } | 360 } |
| 361 options->scale_factor_as_string = cur_arg.substr(8); | 361 options->scale_factor_as_string = cur_arg.substr(8); |
| 362 } else if (cur_arg.size() >= 2 && cur_arg[0] == '-' && cur_arg[1] == '-') { | 362 } else if (cur_arg.size() >= 2 && cur_arg[0] == '-' && cur_arg[1] == '-') { |
| 363 fprintf(stderr, "Unrecognized argument %s\n", cur_arg.c_str()); | 363 fprintf(stderr, "Unrecognized argument %s\n", cur_arg.c_str()); |
| 364 return false; | 364 return false; |
| 365 } else | 365 } else { |
| 366 break; | 366 break; |
| 367 } |
| 367 } | 368 } |
| 368 for (size_t i = cur_idx; i < args.size(); i++) { | 369 for (size_t i = cur_idx; i < args.size(); i++) { |
| 369 files->push_back(args[i]); | 370 files->push_back(args[i]); |
| 370 } | 371 } |
| 371 return true; | 372 return true; |
| 372 } | 373 } |
| 373 | 374 |
| 374 FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { | 375 FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { |
| 375 return true; | 376 return true; |
| 376 } | 377 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 699 } |
| 699 | 700 |
| 700 FPDF_DestroyLibrary(); | 701 FPDF_DestroyLibrary(); |
| 701 #ifdef PDF_ENABLE_V8 | 702 #ifdef PDF_ENABLE_V8 |
| 702 v8::V8::ShutdownPlatform(); | 703 v8::V8::ShutdownPlatform(); |
| 703 delete platform; | 704 delete platform; |
| 704 #endif // PDF_ENABLE_V8 | 705 #endif // PDF_ENABLE_V8 |
| 705 | 706 |
| 706 return 0; | 707 return 0; |
| 707 } | 708 } |
| OLD | NEW |