CE: Cleanups for conversion warnings
1) If converting from float to int, adds an explicit cast as well as
considers rounding.
2) Adjust some arguments from int32_t to uint32_t where that makes
sense.
3) Adds explicit casts from int32_t to uint32_t where a cast is
necessary.
4) Converts constants used in the tests to the right type (float instead
of double, unsigned instead of signed).
Test: Builds with "-Wconversion" enabled locally
Bug: 129481165
Change-Id: I405af72c22f37865537bdefa3f589b4b2930f56c
diff --git a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
index 995a0ca..1e7c97c 100644
--- a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
@@ -35,7 +35,7 @@
slot >= BufferQueue::NUM_BUFFER_SLOTS) {
*outSlot = 0;
} else {
- *outSlot = slot;
+ *outSlot = static_cast<uint32_t>(slot);
}
auto& currentBuffer = mBuffers[*outSlot];