Fix downstream review comments for C++20 This CL addresses the review comments for https://webrtc-review.googlesource.com/c/src/+/261221 in the downstream cherry-pick: https://crrev.com/c/4660950. * Always use size_t{} for casting. * Remove unneeded size_t casts. * Avoid using __x as it is reserved for the compiler. Bug: b:217226507 Change-Id: I13c57cb69d7db066ac9a6dbd15b7f6de54abb613 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311360 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Li-Yu Yu <aaronyu@google.com> Cr-Commit-Position: refs/heads/main@{#40395}
diff --git a/modules/audio_processing/vad/vad_audio_proc.h b/modules/audio_processing/vad/vad_audio_proc.h index cbdd707..905c687 100644 --- a/modules/audio_processing/vad/vad_audio_proc.h +++ b/modules/audio_processing/vad/vad_audio_proc.h
@@ -51,21 +51,19 @@ // For every 30 ms we compute 3 spectral peak there for 3 LPC analysis. // LPC is computed over 15 ms of windowed audio. For every 10 ms sub-frame // we need 5 ms of past signal to create the input of LPC analysis. - static constexpr size_t kNumPastSignalSamples = - static_cast<size_t>(kSampleRateHz / 200); + static constexpr size_t kNumPastSignalSamples = size_t{kSampleRateHz / 200}; // TODO(turajs): maybe defining this at a higher level (maybe enum) so that // all the code recognize it as "no-error." static constexpr int kNoError = 0; static constexpr size_t kNum10msSubframes = 3; - static constexpr size_t kNumSubframeSamples = - static_cast<size_t>(kSampleRateHz / 100); + static constexpr size_t kNumSubframeSamples = size_t{kSampleRateHz / 100}; // Samples in 30 ms @ given sampling rate. static constexpr size_t kNumSamplesToProcess = - size_t{kNum10msSubframes} * kNumSubframeSamples; + kNum10msSubframes * kNumSubframeSamples; static constexpr size_t kBufferLength = - size_t{kNumPastSignalSamples} + kNumSamplesToProcess; + kNumPastSignalSamples + kNumSamplesToProcess; static constexpr size_t kIpLength = kDftSize >> 1; static constexpr size_t kWLength = kDftSize >> 1; static constexpr size_t kLpcOrder = 16;
diff --git a/rtc_base/system/no_unique_address.h b/rtc_base/system/no_unique_address.h index 6bede2c..a40db34 100644 --- a/rtc_base/system/no_unique_address.h +++ b/rtc_base/system/no_unique_address.h
@@ -25,7 +25,7 @@ // clang-cl doesn't support it yet and support is unclear also when the target // platform is iOS. #ifndef __has_cpp_attribute -#define __has_cpp_attribute(__x) 0 +#define __has_cpp_attribute(x) 0 #endif #if __has_cpp_attribute(no_unique_address) // NOLINTNEXTLINE(whitespace/braces)