summaryrefslogtreecommitdiffstats
path: root/include/binder
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-08-31 14:25:22 -0700
committerMathias Agopian <mathias@google.com>2012-08-31 18:09:51 -0700
commit2098517e3e12a401005d7a7510d6c4943707b98d (patch)
tree36f386d752a6e73d37bb79c561b561fe41e0ab07 /include/binder
parent8210185fe337ca9d5b01f2bff8590ea60984c31e (diff)
downloadframeworks_native-2098517e3e12a401005d7a7510d6c4943707b98d.zip
frameworks_native-2098517e3e12a401005d7a7510d6c4943707b98d.tar.gz
frameworks_native-2098517e3e12a401005d7a7510d6c4943707b98d.tar.bz2
make sure Parcel handles 0-sized LightFlatenables
Change-Id: Ib30a1c0228f8a938abaa0c7c8a6ba32ffd971121
Diffstat (limited to 'include/binder')
-rw-r--r--include/binder/Parcel.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 877b17c..3ff95d2 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -285,9 +285,12 @@ status_t Parcel::write(const LightFlattenable<T>& val) {
return err;
}
}
- void* buffer = writeInplace(size);
- return buffer == NULL ? NO_MEMORY :
- val.flatten(buffer);
+ if (size) {
+ void* buffer = writeInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.flatten(buffer);
+ }
+ return NO_ERROR;
}
template<typename T>
@@ -303,9 +306,12 @@ status_t Parcel::read(LightFlattenable<T>& val) const {
}
size = s;
}
- void const* buffer = readInplace(size);
- return buffer == NULL ? NO_MEMORY :
- val.unflatten(buffer, size);
+ if (size) {
+ void const* buffer = readInplace(size);
+ return buffer == NULL ? NO_MEMORY :
+ val.unflatten(buffer, size);
+ }
+ return NO_ERROR;
}
// ---------------------------------------------------------------------------