Remove unnecessary static_casts in exception handling.
The switch statements on `exception_information[0]` do not
require casting to enum types, as the case labels are already
the integer values of the enum members.
Upstreaming this fix from Google.
Bug: b:452247353
Change-Id: I22e4a4394cdfa405e6ef94548961cdad37eb78a6
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/7069979
Reviewed-by: Mark Mentovai <mark@chromium.org>
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index 0287d6f..00a1aa6 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -1323,10 +1323,7 @@
// This information is useful in addition to the code address, which
// will be present in the crash thread's instruction field anyway.
if (raw_exception->exception_record.number_parameters >= 1) {
- MDAccessViolationTypeWin av_type =
- static_cast<MDAccessViolationTypeWin>
- (raw_exception->exception_record.exception_information[0]);
- switch (av_type) {
+ switch (raw_exception->exception_record.exception_information[0]) {
case MD_ACCESS_VIOLATION_WIN_READ:
reason = "EXCEPTION_ACCESS_VIOLATION_READ";
break;
@@ -1360,10 +1357,7 @@
// This information is useful in addition to the code address, which
// will be present in the crash thread's instruction field anyway.
if (raw_exception->exception_record.number_parameters >= 1) {
- MDInPageErrorTypeWin av_type =
- static_cast<MDInPageErrorTypeWin>
- (raw_exception->exception_record.exception_information[0]);
- switch (av_type) {
+ switch (raw_exception->exception_record.exception_information[0]) {
case MD_IN_PAGE_ERROR_WIN_READ:
reason = "EXCEPTION_IN_PAGE_ERROR_READ";
break;