Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Fix incorrect use of scoped enumerations in format strings (#203)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Auto-Submit: Hans Wennborg <[email protected]>
Commit-Queue: Rasmus Brandt <[email protected]>
Cr-Commit-Position: refs/heads/main@{#40321}

Co-authored-by: Hans Wennborg <[email protected]>
  • Loading branch information
jianjunz and zmodem authored Dec 7, 2023
1 parent 49d511c commit 27b254f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/video_codecs/h264_profile_level_id.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}

Expand Down

0 comments on commit 27b254f

Please sign in to comment.