diff options
author | Narayan Kamath <narayan@google.com> | 2014-06-06 10:05:08 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-06 10:05:09 +0000 |
commit | e86420e399993e0f49e5d7733b5fc87eb9fe179b (patch) | |
tree | 224fdbcc9413c9348e71c71a530b2e29ed5d3b0b | |
parent | 8adb5a822d44ed43aa0ec9a8948a7820fdfcd375 (diff) | |
parent | 403ec9f15a9cf2fedea2e2e0a24421dc30625140 (diff) | |
download | frameworks_native-e86420e399993e0f49e5d7733b5fc87eb9fe179b.zip frameworks_native-e86420e399993e0f49e5d7733b5fc87eb9fe179b.tar.gz frameworks_native-e86420e399993e0f49e5d7733b5fc87eb9fe179b.tar.bz2 |
Merge "Fix flattening/unflattening of android::Sensor."
-rw-r--r-- | libs/gui/Sensor.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp index da6b0f9..e8948bb 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<uint32_t>(mName.length())); memcpy(static_cast<char*>(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<uint32_t>(mVendor.length())); memcpy(static_cast<char*>(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<char const*>(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; |