diff options
author | Mathias Agopian <mathias@google.com> | 2013-07-29 21:24:40 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-07-30 21:19:13 -0700 |
commit | e142428a9c8b9d2380032cd4d7b55ee440fe8770 (patch) | |
tree | 7c55a190ef023bc7aba348d040211901448c13d3 /libs/binder | |
parent | 1d76781b7aa19611c4045fdf6b848af6c6094e0b (diff) | |
download | frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.zip frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.tar.gz frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.tar.bz2 |
Make Flattenable not virtual
Fallout from the Flattenable change, update all its uses.
Additionnaly, fix/tighten size checks when (un)flatten()ing
things.
Removed the assumption by some flattenables (e.g.: Fence)
that the size passed to them would be exact (it can
and will be larger in some cases)
The code in Parcel is a bit complicated so that we don't
have to expose the full implementation (and also to
keep the code smallish).
Change-Id: I0bf1c8aca2a3128491b4f45510bc46667e566dde
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/Parcel.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 359742c..7a5919f 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -798,13 +798,13 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) return status; } -status_t Parcel::write(const Flattenable& val) +status_t Parcel::write(const FlattenableHelperInterface& val) { status_t err; // size if needed - size_t len = val.getFlattenedSize(); - size_t fd_count = val.getFdCount(); + const size_t len = val.getFlattenedSize(); + const size_t fd_count = val.getFdCount(); err = this->writeInt32(len); if (err) return err; @@ -813,7 +813,7 @@ status_t Parcel::write(const Flattenable& val) if (err) return err; // payload - void* buf = this->writeInplace(PAD_SIZE(len)); + void* const buf = this->writeInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; @@ -1174,14 +1174,14 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const return NO_ERROR; } -status_t Parcel::read(Flattenable& val) const +status_t Parcel::read(FlattenableHelperInterface& val) const { // size const size_t len = this->readInt32(); const size_t fd_count = this->readInt32(); // payload - void const* buf = this->readInplace(PAD_SIZE(len)); + void const* const buf = this->readInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; |