fixed deSerialize
This commit is contained in:
parent
26b63d63b9
commit
825bf62d79
@ -20,9 +20,9 @@ template<typename count_t>
|
|||||||
SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
|
SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename count_t>
|
||||||
ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size,
|
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer,
|
||||||
size_t maxSize, Endianness streamEndianness) const {
|
size_t* size, size_t maxSize, Endianness streamEndianness) const {
|
||||||
uint32_t serializedLength = bufferLength;
|
uint32_t serializedLength = bufferLength;
|
||||||
if (serializeLength) {
|
if (serializeLength) {
|
||||||
serializedLength += SerializeAdapter::getSerializedSize(
|
serializedLength += SerializeAdapter::getSerializedSize(
|
||||||
@ -53,8 +53,8 @@ ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename count_t>
|
||||||
size_t SerialBufferAdapter<T>::getSerializedSize() const {
|
size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
|
||||||
if (serializeLength) {
|
if (serializeLength) {
|
||||||
return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength);
|
return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength);
|
||||||
} else {
|
} else {
|
||||||
@ -62,20 +62,16 @@ size_t SerialBufferAdapter<T>::getSerializedSize() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename count_t>
|
||||||
ReturnValue_t SerialBufferAdapter<T>::deSerialize(const uint8_t** buffer,
|
ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
||||||
size_t* size, Endianness streamEndianness) {
|
size_t* size, Endianness streamEndianness) {
|
||||||
//TODO Ignores Endian flag!
|
//TODO Ignores Endian flag!
|
||||||
if (buffer != NULL) {
|
if (buffer != nullptr) {
|
||||||
if(serializeLength){
|
if(serializeLength){
|
||||||
T serializedSize = SerializeAdapter::getSerializedSize(
|
ReturnValue_t result = SerializeAdapter::deSerialize(&bufferLength,
|
||||||
&bufferLength);
|
buffer, size, streamEndianness);
|
||||||
if(bufferLength + serializedSize <= *size) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
*buffer += serializedSize;
|
return result;
|
||||||
*size -= serializedSize;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return STREAM_TOO_SHORT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//No Else If, go on with buffer
|
//No Else If, go on with buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user