Fix incorrect use of scoped enumerations in format strings

Scoped enums do not get automatically promoted to their underlying type,
so these uses have undefined behavior and Clang recently started warning
about it.

Bug: chromium:1456289
Change-Id: I9cf4e5a68378930a3bf7d8ac7b0a21eaf0d12670
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309520
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40321}
This commit is contained in:
Hans Wennborg 2023-06-20 15:56:51 +02:00 committed by WebRTC LUCI CQ
parent c4e0254909
commit d1780836f4

View File

@ -238,7 +238,8 @@ absl::optional<std::string> H264ProfileLevelIdToString(
}
char str[7];
snprintf(str, 7u, "%s%02x", profile_idc_iop_string, profile_level_id.level);
snprintf(str, 7u, "%s%02x", profile_idc_iop_string,
static_cast<unsigned>(profile_level_id.level));
return {str};
}