bmpblk_utility: fix build warnings (errors) with USE="-minimal"

Warning like this:

utility/bmpblk_utility.cc: In member function 'void vboot_reference::BmpBlockUtil::load_yaml_config(const char*)':
utility/bmpblk_utility.cc:104:61: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'std::vector<std::basic_string<char> >::size_type {aka unsigned int}' [-Werror=format=]
       printf("%ld image_names\n", config_.image_names.size());
                                                             ^
utility/bmpblk_utility.cc:108:59: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'std::map<std::basic_string<char>, vboot_reference::ImageConfig>::size_type {aka unsigned int}' [-Werror=format=]
       printf("%ld images_map\n", config_.images_map.size());
                                                           ^
utility/bmpblk_utility.cc:119:61: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'std::map<std::basic_string<char>, vboot_reference::ScreenConfig>::size_type {aka unsigned int}' [-Werror=format=]
       printf("%ld screens_map\n", config_.screens_map.size());
                                                             ^
utility/bmpblk_utility.cc: In member function 'void vboot_reference::BmpBlockUtil::pack_bmpblock()':
utility/bmpblk_utility.cc:597:70: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'std::basic_string<char>::size_type {aka unsigned int}' [-Werror=format=]
                current_offset, it->second.compressed_content.length());
                                                                      ^
utility/bmpblk_utility.cc:609:59: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'std::basic_string<char>::size_type {aka unsigned int}' [-Werror=format=]
                current_offset, config_.locale_names.size());
                                                           ^

Technically, C++ container::size_type is slightly different than size_t, but I
think %zd should work fine.

BRANCH=none
BUG=none
TEST=`USE="-minimal" emerge-kevin vboot_reference`

Change-Id: I9d0b22818714cad2ad7e95557df7837c91c2b0f7
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362621
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Brian Norris
2016-07-22 10:17:56 -07:00
committed by chrome-bot
parent 1d4c49b94f
commit c61df529d0

View File

@@ -101,11 +101,11 @@ namespace vboot_reference {
// The number of localizations should match the number of locale_index // The number of localizations should match the number of locale_index
if (debug_) { if (debug_) {
printf("%ld image_names\n", config_.image_names.size()); printf("%zd image_names\n", config_.image_names.size());
for (unsigned int i = 0; i < config_.image_names.size(); ++i) { for (unsigned int i = 0; i < config_.image_names.size(); ++i) {
printf(" %d: \"%s\"\n", i, config_.image_names[i].c_str()); printf(" %d: \"%s\"\n", i, config_.image_names[i].c_str());
} }
printf("%ld images_map\n", config_.images_map.size()); printf("%zd images_map\n", config_.images_map.size());
for (StrImageConfigMap::iterator it = config_.images_map.begin(); for (StrImageConfigMap::iterator it = config_.images_map.begin();
it != config_.images_map.end(); it != config_.images_map.end();
++it) { ++it) {
@@ -116,7 +116,7 @@ namespace vboot_reference {
it->second.data.tag, it->second.data.tag,
it->second.data.format); it->second.data.format);
} }
printf("%ld screens_map\n", config_.screens_map.size()); printf("%zd screens_map\n", config_.screens_map.size());
for (StrScreenConfigMap::iterator it = config_.screens_map.begin(); for (StrScreenConfigMap::iterator it = config_.screens_map.begin();
it != config_.screens_map.end(); it != config_.screens_map.end();
++it) { ++it) {
@@ -593,7 +593,7 @@ namespace vboot_reference {
current_filled += sizeof(it->second.data); current_filled += sizeof(it->second.data);
current_offset += sizeof(it->second.data); current_offset += sizeof(it->second.data);
if (debug_) if (debug_)
printf("I1: current offset is 0x%08x (len %ld)\n", printf("I1: current offset is 0x%08x (len %zd)\n",
current_offset, it->second.compressed_content.length()); current_offset, it->second.compressed_content.length());
std::copy(it->second.compressed_content.begin(), std::copy(it->second.compressed_content.begin(),
it->second.compressed_content.end(), it->second.compressed_content.end(),
@@ -605,7 +605,7 @@ namespace vboot_reference {
current_offset = config_.header.locale_string_offset; current_offset = config_.header.locale_string_offset;
current_filled = bmpblock_.begin() + current_offset; current_filled = bmpblock_.begin() + current_offset;
if (debug_) if (debug_)
printf("locale_names: offset 0x%08x (len %ld)\n", printf("locale_names: offset 0x%08x (len %zd)\n",
current_offset, config_.locale_names.size()); current_offset, config_.locale_names.size());
std::copy(config_.locale_names.begin(), std::copy(config_.locale_names.begin(),
config_.locale_names.end(), config_.locale_names.end(),