| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 // Utility for manipulating Google Binary Block (GBB) | 5 // Utility for manipulating Google Binary Block (GBB) |
| 6 // | 6 // |
| 7 | 7 |
| 8 #include "gbb_utility.h" | 8 #include "gbb_utility.h" |
| 9 | 9 |
| 10 #include <assert.h> | 10 #include <assert.h> |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 const char *myname = argv[0]; | 468 const char *myname = argv[0]; |
| 469 int err_stage = 0; // an indicator for error exits | 469 int err_stage = 0; // an indicator for error exits |
| 470 | 470 |
| 471 // small parameter helper class | 471 // small parameter helper class |
| 472 class OptPropertyMap: public | 472 class OptPropertyMap: public |
| 473 std::map<GoogleBinaryBlockUtil::PROPINDEX, string> { | 473 std::map<GoogleBinaryBlockUtil::PROPINDEX, string> { |
| 474 public: | 474 public: |
| 475 bool set_new_value(GoogleBinaryBlockUtil::PROPINDEX id, const string &v) { | 475 bool set_new_value(GoogleBinaryBlockUtil::PROPINDEX id, const string &v) { |
| 476 if (find(id) != end()) | 476 if (find(id) != end()) |
| 477 return false; | 477 return false; |
| 478 |
| 478 (*this)[id] = v; | 479 (*this)[id] = v; |
| 479 return true; | 480 return true; |
| 480 } | 481 } |
| 481 }; | 482 }; |
| 482 OptPropertyMap opt_props; | 483 OptPropertyMap opt_props; |
| 483 | 484 |
| 484 struct GBBUtilOptions { | 485 struct GBBUtilOptions { |
| 485 bool get_mode, set_mode; | 486 bool get_mode, set_mode; |
| 486 string input_fn, output_fn; | 487 string input_fn, output_fn; |
| 487 } myopts; | 488 } myopts; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return err_stage; | 639 return err_stage; |
| 639 } else { | 640 } else { |
| 640 printf("successfully saved new image to: %s\n", myopts.output_fn.c_str()); | 641 printf("successfully saved new image to: %s\n", myopts.output_fn.c_str()); |
| 641 } | 642 } |
| 642 } | 643 } |
| 643 | 644 |
| 644 return 0; | 645 return 0; |
| 645 } | 646 } |
| 646 | 647 |
| 647 #endif // WITH_UTIL_MAIN | 648 #endif // WITH_UTIL_MAIN |
| 648 | |
| OLD | NEW |