am 2098517e
: make sure Parcel handles 0-sized LightFlatenables
* commit '2098517e3e12a401005d7a7510d6c4943707b98d': make sure Parcel handles 0-sized LightFlatenables
This commit is contained in:
commit
df0adbbb60
@ -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;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user