Paul Kirth would like Owners Override to review this change.
[media][audio] Fix -Wimplicit-int-conversion errors
New versions of clang will start warning about more cases when the
conversion happens.
diff --git a/src/media/audio/audio_core/test/api/audio_renderer_pipeline_test_shared.h b/src/media/audio/audio_core/test/api/audio_renderer_pipeline_test_shared.h
index 9ca1fd5..68300c8 100644
--- a/src/media/audio/audio_core/test/api/audio_renderer_pipeline_test_shared.h
+++ b/src/media/audio/audio_core/test/api/audio_renderer_pipeline_test_shared.h
@@ -376,7 +376,7 @@
AudioBuffer<fuchsia::media::AudioSampleFormat::SIGNED_16>* audio_buffer_ptr) {
auto& samples = audio_buffer_ptr->samples();
for (std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT& sample : samples) {
- sample = -sample;
+ sample = static_cast<std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT>(-sample);
}
}
@@ -499,7 +499,7 @@
AudioBuffer<fuchsia::media::AudioSampleFormat::SIGNED_16>* audio_buffer_ptr) {
auto& samples = audio_buffer_ptr->samples();
for (std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT& sample : samples) {
- sample = -sample;
+ sample = static_cast<std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT>(-sample);
}
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Owners-Override | +1 |
Setting O-O to unblock the clang roll.
I do think this is worth some follow-up by the code owners, see comment below.
sample = static_cast<std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT>(-sample);can we make this a local type alias to avoid repeating it in the loop and here?
this does bring up the point of what is this logic expected to do given a sample of std::numeric_limits<SampleT>::min() whose inversion is not representable in the type
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
sample = static_cast<std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT>(-sample);can we make this a local type alias to avoid repeating it in the loop and here?
this does bring up the point of what is this logic expected to do given a sample of std::numeric_limits<SampleT>::min() whose inversion is not representable in the type
Fix applied.
sample = static_cast<std::remove_pointer_t<decltype(audio_buffer_ptr)>::SampleT>(-sample);can we make this a local type alias to avoid repeating it in the loop and here?
this does bring up the point of what is this logic expected to do given a sample of std::numeric_limits<SampleT>::min() whose inversion is not representable in the type
Fix applied. Surprised the AI seemed to do this correctly 😊.
Not sure how to answer your question regarding the logic, though. To get around the new warning and unblock our CI I was mostly just trying to keep the existing logic in place.
I'll leave this unresolved in case you want to hold off landing.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Or now I'll mark it unresolved
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[media][audio] Fix -Wimplicit-int-conversion errors
New versions of clang will start warning about more cases when the
conversion happens.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Or now I'll mark it unresolved
This is preserving behavior so I think it's valid to land and have the owners take a look later.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Change has been successfully rolled: http://go/roll-cl/5e2c4dbec26ad1971011becb006549a04ca9d420
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
James RobinsonOr now I'll mark it unresolved
This is preserving behavior so I think it's valid to land and have the owners take a look later.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |