1
0
forked from fsfw/fsfw

working on updating SerializeIF, to quote Basti: This is going to be horrible

This commit is contained in:
2020-04-21 21:34:03 +02:00
parent 05c1330b68
commit 2093329481
35 changed files with 389 additions and 341 deletions

View File

@ -145,10 +145,12 @@ uint16_t PoolRawAccess::getSizeTillEnd() const {
return sizeTillEnd;
}
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
const uint32_t max_size, bool bigEndian) const {
if (typeSize + *size <= max_size) {
if (bigEndian) {
ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const {
//TODO integer overflow
if (typeSize + *size <= maxSize) {
#error use endian swapper
if (1) {
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN
@ -169,16 +171,16 @@ ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size,
}
}
uint32_t PoolRawAccess::getSerializedSize() const {
size_t PoolRawAccess::getSerializedSize() const {
return typeSize;
}
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, int32_t* size,
bool bigEndian) {
*size -= typeSize;
if (*size >= 0) {
ReturnValue_t PoolRawAccess::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
if (bigEndian) {
if (*size >= typeSize) {
*size -= typeSize;
if (1) {
#ifndef BYTE_ORDER_SYSTEM
#error BYTE_ORDER_SYSTEM not defined
#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN