1
0
forked from fsfw/fsfw

typo fixes

This commit is contained in:
2020-08-28 18:46:47 +02:00
parent b4978e7df3
commit 7a5c70e753
8 changed files with 126 additions and 82 deletions

View File

@ -1,20 +1,19 @@
#include "ParameterWrapper.h"
ParameterWrapper::ParameterWrapper() :
pointsToStream(false), type(Type::UNKNOWN_TYPE), rows(0), columns(0), data(
NULL), readonlyData(NULL) {
pointsToStream(false), type(Type::UNKNOWN_TYPE) {
}
ParameterWrapper::ParameterWrapper(Type type, uint8_t rows, uint8_t columns,
void *data) :
pointsToStream(false), type(type), rows(rows), columns(columns), data(
data), readonlyData(data) {
pointsToStream(false), type(type), rows(rows), columns(columns),
data(data), readonlyData(data) {
}
ParameterWrapper::ParameterWrapper(Type type, uint8_t rows, uint8_t columns,
const void *data) :
pointsToStream(false), type(type), rows(rows), columns(columns), data(
NULL), readonlyData(data) {
pointsToStream(false), type(type), rows(rows), columns(columns),
data(nullptr), readonlyData(data) {
}
ParameterWrapper::~ParameterWrapper() {
@ -141,6 +140,7 @@ ReturnValue_t ParameterWrapper::deSerializeData(uint8_t startingRow,
}
ReturnValue_t ParameterWrapper::deSerialize(const uint8_t **buffer,
size_t *size, Endianness streamEndianness) {
return deSerialize(buffer, size, streamEndianness, 0);
@ -184,16 +184,16 @@ ReturnValue_t ParameterWrapper::set(const uint8_t *stream, size_t streamSize,
return SerializeIF::STREAM_TOO_SHORT;
}
data = NULL;
data = nullptr;
readonlyData = stream;
pointsToStream = true;
stream += dataSize;
if (remainingStream != NULL) {
if (remainingStream != nullptr) {
*remainingStream = stream;
}
streamSize -= dataSize;
if (remainingSize != NULL) {
if (remainingSize != nullptr) {
*remainingSize = streamSize;
}
@ -265,15 +265,14 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
result = UNKNOW_DATATYPE;
break;
}
} else {
}
else {
//need a type to do arithmetic
uint8_t *toDataWithType = (uint8_t*) data;
uint8_t* typedData = static_cast<uint8_t*>(data);
for (uint8_t fromRow = 0; fromRow < from->rows; fromRow++) {
memcpy(
toDataWithType
+ (((startingRow + fromRow) * columns)
+ startingColumn) * typeSize,
from->readonlyData, typeSize * from->columns);
uint8_t offset = (((startingRow + fromRow) * columns) + startingColumn) * typeSize;
std::memcpy(typedData + offset, from->readonlyData,
typeSize * from->columns);
}
}