Modernize MinidumpCrashpadInfo::Print().

Use range-based for-loops where appropriate.

Change-Id: I2fffd270d434c90850e8151ee40e5adf0736ce55
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3120666
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Lei Zhang 2021-08-25 21:20:02 -07:00
parent 7933ec0a69
commit 5645ad8275

View file

@ -4983,12 +4983,9 @@ void MinidumpCrashpadInfo::Print() {
MDGUIDToString(crashpad_info_.report_id).c_str()); MDGUIDToString(crashpad_info_.report_id).c_str());
printf(" client_id = %s\n", printf(" client_id = %s\n",
MDGUIDToString(crashpad_info_.client_id).c_str()); MDGUIDToString(crashpad_info_.client_id).c_str());
for (std::map<std::string, std::string>::const_iterator iterator = for (const auto& annot : simple_annotations_) {
simple_annotations_.begin(); printf(" simple_annotations[\"%s\"] = %s\n", annot.first.c_str(),
iterator != simple_annotations_.end(); annot.second.c_str());
++iterator) {
printf(" simple_annotations[\"%s\"] = %s\n",
iterator->first.c_str(), iterator->second.c_str());
} }
for (uint32_t module_index = 0; for (uint32_t module_index = 0;
module_index < module_crashpad_info_links_.size(); module_index < module_crashpad_info_links_.size();
@ -4997,23 +4994,18 @@ void MinidumpCrashpadInfo::Print() {
module_index, module_crashpad_info_links_[module_index]); module_index, module_crashpad_info_links_[module_index]);
printf(" module_list[%d].version = %d\n", printf(" module_list[%d].version = %d\n",
module_index, module_crashpad_info_[module_index].version); module_index, module_crashpad_info_[module_index].version);
for (uint32_t annotation_index = 0; const auto& list_annots =
annotation_index < module_crashpad_info_list_annotations_[module_index];
module_crashpad_info_list_annotations_[module_index].size(); for (uint32_t annotation_index = 0; annotation_index < list_annots.size();
++annotation_index) { ++annotation_index) {
printf(" module_list[%d].list_annotations[%d] = %s\n", printf(" module_list[%d].list_annotations[%d] = %s\n", module_index,
module_index, annotation_index, list_annots[annotation_index].c_str());
annotation_index,
module_crashpad_info_list_annotations_
[module_index][annotation_index].c_str());
} }
for (std::map<std::string, std::string>::const_iterator iterator = const auto& simple_annots =
module_crashpad_info_simple_annotations_[module_index].begin(); module_crashpad_info_simple_annotations_[module_index];
iterator != for (const auto& annot : simple_annots) {
module_crashpad_info_simple_annotations_[module_index].end();
++iterator) {
printf(" module_list[%d].simple_annotations[\"%s\"] = %s\n", printf(" module_list[%d].simple_annotations[\"%s\"] = %s\n",
module_index, iterator->first.c_str(), iterator->second.c_str()); module_index, annot.first.c_str(), annot.second.c_str());
} }
} }