serial buffer adapter bugfix
This commit is contained in:
parent
206235ed47
commit
6838a9e768
@ -21,29 +21,29 @@ SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename count_t>
|
template<typename count_t>
|
||||||
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer,
|
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer_,
|
||||||
size_t* size, const size_t max_size, bool bigEndian) const {
|
size_t* size_, const size_t max_size, bool bigEndian) const {
|
||||||
uint32_t serializedLength = bufferLength;
|
uint32_t serializedLength = bufferLength;
|
||||||
if (serializeLength) {
|
if (serializeLength) {
|
||||||
serializedLength += AutoSerializeAdapter::getSerializedSize(
|
serializedLength += AutoSerializeAdapter::getSerializedSize(
|
||||||
&bufferLength);
|
&bufferLength);
|
||||||
}
|
}
|
||||||
if (*size + serializedLength > max_size) {
|
if (*size_ + serializedLength > max_size) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
} else {
|
} else {
|
||||||
if (serializeLength) {
|
if (serializeLength) {
|
||||||
AutoSerializeAdapter::serialize(&bufferLength, buffer, size,
|
AutoSerializeAdapter::serialize(&bufferLength, buffer_, size_,
|
||||||
max_size, bigEndian);
|
max_size, bigEndian);
|
||||||
}
|
}
|
||||||
if (constBuffer != nullptr) {
|
if (constBuffer != nullptr) {
|
||||||
memcpy(*buffer, constBuffer, bufferLength);
|
memcpy(*buffer_, this->constBuffer, bufferLength);
|
||||||
} else if (buffer != nullptr) {
|
} else if (buffer != nullptr) {
|
||||||
memcpy(*buffer, buffer, bufferLength);
|
memcpy(*buffer_, this->buffer, bufferLength);
|
||||||
} else {
|
} else {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
*size += bufferLength;
|
*size_ += bufferLength;
|
||||||
(*buffer) += bufferLength;
|
(*buffer_) += bufferLength;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
virtual ~SerialBufferAdapter();
|
virtual ~SerialBufferAdapter();
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
virtual ReturnValue_t serialize(uint8_t** buffer_, size_t* size,
|
||||||
const size_t max_size, bool bigEndian) const override;
|
const size_t max_size, bool bigEndian) const override;
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const;
|
virtual size_t getSerializedSize() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user