diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp index da6b0f97f..e8948bba1 100644 --- a/libs/gui/Sensor.cpp +++ b/libs/gui/Sensor.cpp @@ -134,11 +134,11 @@ status_t Sensor::flatten(void* buffer, size_t size) const { return NO_MEMORY; } - FlattenableUtils::write(buffer, size, mName.length()); + FlattenableUtils::write(buffer, size, static_cast(mName.length())); memcpy(static_cast(buffer), mName.string(), mName.length()); FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(mName.length())); - FlattenableUtils::write(buffer, size, mVendor.length()); + FlattenableUtils::write(buffer, size, static_cast(mVendor.length())); memcpy(static_cast(buffer), mVendor.string(), mVendor.length()); FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(mVendor.length())); @@ -156,9 +156,9 @@ status_t Sensor::flatten(void* buffer, size_t size) const { } status_t Sensor::unflatten(void const* buffer, size_t size) { - size_t len; + uint32_t len; - if (size < sizeof(size_t)) { + if (size < sizeof(uint32_t)) { return NO_MEMORY; } FlattenableUtils::read(buffer, size, len); @@ -169,7 +169,7 @@ status_t Sensor::unflatten(void const* buffer, size_t size) { FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len)); - if (size < sizeof(size_t)) { + if (size < sizeof(uint32_t)) { return NO_MEMORY; } FlattenableUtils::read(buffer, size, len); @@ -179,7 +179,7 @@ status_t Sensor::unflatten(void const* buffer, size_t size) { mVendor.setTo(static_cast(buffer), len); FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len)); - size_t fixedSize = + const size_t fixedSize = sizeof(int32_t) * 3 + sizeof(float) * 4 + sizeof(int32_t) * 3;