From 904abfba28f55d4f2985c81cf8954e92015db321 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 8 Aug 2022 18:29:32 +0200 Subject: [PATCH] clean up CFDP stack a bit --- src/fsfw/cfdp/FileSize.h | 12 ++--- src/fsfw/cfdp/pdu/AckPduDeserializer.cpp | 2 +- src/fsfw/cfdp/pdu/EofPduDeserializer.cpp | 2 +- src/fsfw/cfdp/pdu/FileDataReader.cpp | 2 +- src/fsfw/cfdp/pdu/FileDirectiveReader.cpp | 4 +- src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp | 2 +- src/fsfw/cfdp/pdu/HeaderReader.cpp | 54 ++++++++++--------- src/fsfw/cfdp/pdu/HeaderReader.h | 11 +++- .../cfdp/pdu/KeepAlivePduDeserializer.cpp | 2 +- src/fsfw/cfdp/pdu/MetadataPduReader.cpp | 2 +- src/fsfw/cfdp/pdu/NakPduDeserializer.cpp | 2 +- src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp | 2 +- src/fsfw/cfdp/tlv/Lv.cpp | 7 +++ src/fsfw/cfdp/tlv/Lv.h | 3 +- src/fsfw/storagemanager/LocalPool.h | 2 +- unittests/cfdp/testDistributor.cpp | 28 ++++++++-- unittests/cfdp/testMetadataPdu.cpp | 8 +-- unittests/cfdp/testTlvsLvs.cpp | 4 +- 18 files changed, 96 insertions(+), 53 deletions(-) diff --git a/src/fsfw/cfdp/FileSize.h b/src/fsfw/cfdp/FileSize.h index 6dae9683..521d5a6f 100644 --- a/src/fsfw/cfdp/FileSize.h +++ b/src/fsfw/cfdp/FileSize.h @@ -1,5 +1,5 @@ -#ifndef FSFW_SRC_FSFW_CFDP_FILESIZE_H_ -#define FSFW_SRC_FSFW_CFDP_FILESIZE_H_ +#ifndef FSFW_CFDP_FILESIZE_H_ +#define FSFW_CFDP_FILESIZE_H_ #include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeIF.h" @@ -10,7 +10,7 @@ struct FileSize : public SerializeIF { public: FileSize() : largeFile(false){}; - FileSize(uint64_t fileSize, bool isLarge = false) { setFileSize(fileSize, isLarge); }; + explicit FileSize(uint64_t fileSize, bool isLarge = false) { setFileSize(fileSize, isLarge); }; ReturnValue_t serialize(bool isLarge, uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) { @@ -27,7 +27,7 @@ struct FileSize : public SerializeIF { return SerializeAdapter::serialize(&fileSize, buffer, size, maxSize, streamEndianness); } - size_t getSerializedSize() const override { + [[nodiscard]] size_t getSerializedSize() const override { if (largeFile) { return 8; } else { @@ -60,7 +60,7 @@ struct FileSize : public SerializeIF { return HasReturnvaluesIF::RETURN_OK; } - bool isLargeFile() const { return largeFile; } + [[nodiscard]] bool isLargeFile() const { return largeFile; } uint64_t getSize(bool *largeFile = nullptr) const { if (largeFile != nullptr) { *largeFile = this->largeFile; @@ -75,4 +75,4 @@ struct FileSize : public SerializeIF { } // namespace cfdp -#endif /* FSFW_SRC_FSFW_CFDP_FILESIZE_H_ */ +#endif /* FSFW_CFDP_FILESIZE_H_ */ diff --git a/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp b/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp index 1217344e..9d7c981d 100644 --- a/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/AckPduDeserializer.cpp @@ -12,7 +12,7 @@ ReturnValue_t AckPduDeserializer::parseData() { if (currentIdx + 2 > this->maxSize) { return SerializeIF::BUFFER_TOO_SHORT; } - if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) { + if (not checkAndSetCodes(pointers.rawPtr[currentIdx], pointers.rawPtr[currentIdx + 1])) { return cfdp::INVALID_ACK_DIRECTIVE_FIELDS; } return HasReturnvaluesIF::RETURN_OK; diff --git a/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp b/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp index e532419f..4de67a0e 100644 --- a/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/EofPduDeserializer.cpp @@ -12,7 +12,7 @@ ReturnValue_t EofPduDeserializer::parseData() { return result; } - const uint8_t* bufPtr = rawPtr; + const uint8_t* bufPtr = pointers.rawPtr; size_t expectedFileFieldLen = 4; if (this->getLargeFileFlag()) { expectedFileFieldLen = 8; diff --git a/src/fsfw/cfdp/pdu/FileDataReader.cpp b/src/fsfw/cfdp/pdu/FileDataReader.cpp index 30581da4..e620636f 100644 --- a/src/fsfw/cfdp/pdu/FileDataReader.cpp +++ b/src/fsfw/cfdp/pdu/FileDataReader.cpp @@ -9,7 +9,7 @@ ReturnValue_t FileDataReader::parseData() { return result; } size_t currentIdx = HeaderReader::getHeaderSize(); - const uint8_t* buf = rawPtr + currentIdx; + const uint8_t* buf = pointers.rawPtr + currentIdx; size_t remSize = HeaderReader::getWholePduSize() - currentIdx; if (remSize < 1) { return SerializeIF::STREAM_TOO_SHORT; diff --git a/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp b/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp index d51846b8..bc06a9d7 100644 --- a/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp +++ b/src/fsfw/cfdp/pdu/FileDirectiveReader.cpp @@ -17,10 +17,10 @@ ReturnValue_t FileDirectiveReader::parseData() { return SerializeIF::STREAM_TOO_SHORT; } size_t currentIdx = HeaderReader::getHeaderSize(); - if (not checkFileDirective(rawPtr[currentIdx])) { + if (not checkFileDirective(pointers.rawPtr[currentIdx])) { return cfdp::INVALID_DIRECTIVE_FIELDS; } - setFileDirective(static_cast(rawPtr[currentIdx])); + setFileDirective(static_cast(pointers.rawPtr[currentIdx])); return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp b/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp index 4209af65..7776778b 100644 --- a/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/FinishedPduDeserializer.cpp @@ -10,7 +10,7 @@ ReturnValue_t FinishPduDeserializer::parseData() { return result; } size_t currentIdx = FileDirectiveReader::getHeaderSize(); - const uint8_t* buf = rawPtr + currentIdx; + const uint8_t* buf = pointers.rawPtr + currentIdx; size_t remSize = FileDirectiveReader::getWholePduSize() - currentIdx; if (remSize < 1) { return SerializeIF::STREAM_TOO_SHORT; diff --git a/src/fsfw/cfdp/pdu/HeaderReader.cpp b/src/fsfw/cfdp/pdu/HeaderReader.cpp index cd8667b2..c946ce27 100644 --- a/src/fsfw/cfdp/pdu/HeaderReader.cpp +++ b/src/fsfw/cfdp/pdu/HeaderReader.cpp @@ -4,41 +4,42 @@ #include -HeaderReader::HeaderReader(const uint8_t *pduBuf, size_t maxSize) - : rawPtr(pduBuf), maxSize(maxSize) {} +HeaderReader::HeaderReader(const uint8_t *pduBuf, size_t maxSize) { setData(pduBuf, maxSize); } ReturnValue_t HeaderReader::parseData() { + if (isNull()) { + return HasReturnvaluesIF::RETURN_FAILED; + } if (maxSize < 7) { return SerializeIF::STREAM_TOO_SHORT; } - return setData(const_cast(rawPtr), maxSize); -} - -ReturnValue_t HeaderReader::setData(uint8_t *dataPtr, size_t maxSize_, void *args) { - if (dataPtr == nullptr) { - // Allowed for now - this->fixedHeader = nullptr; - return HasReturnvaluesIF::RETURN_OK; - } - this->fixedHeader = reinterpret_cast(const_cast(dataPtr)); - sourceIdRaw = static_cast(&fixedHeader->variableFieldsStart); + sourceIdRaw = static_cast(&pointers.fixedHeader->variableFieldsStart); cfdp::WidthInBytes widthEntityIds = getLenEntityIds(); cfdp::WidthInBytes widthSeqNum = getLenSeqNum(); seqNumRaw = static_cast(sourceIdRaw) + static_cast(widthEntityIds); destIdRaw = static_cast(seqNumRaw) + static_cast(widthSeqNum); + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t HeaderReader::setData(uint8_t *dataPtr, size_t maxSize_, void *args) { + if (maxSize_ < 7) { + return SerializeIF::STREAM_TOO_SHORT; + } + pointers.rawPtr = dataPtr; + pointers.fixedHeader = reinterpret_cast(const_cast(dataPtr)); maxSize = maxSize_; return HasReturnvaluesIF::RETURN_OK; } size_t HeaderReader::getHeaderSize() const { - if (fixedHeader != nullptr) { + if (pointers.fixedHeader != nullptr) { return getLenEntityIds() * 2 + getLenSeqNum() + 4; } return 0; } size_t HeaderReader::getPduDataFieldLen() const { - return (fixedHeader->pduDataFieldLenH << 8) | fixedHeader->pduDataFieldLenL; + return (pointers.fixedHeader->pduDataFieldLenH << 8) | pointers.fixedHeader->pduDataFieldLenL; } size_t HeaderReader::getWholePduSize() const { @@ -46,35 +47,35 @@ size_t HeaderReader::getWholePduSize() const { } cfdp::PduType HeaderReader::getPduType() const { - return static_cast((fixedHeader->firstByte >> 4) & 0x01); + return static_cast((pointers.fixedHeader->firstByte >> 4) & 0x01); } cfdp::Direction HeaderReader::getDirection() const { - return static_cast((fixedHeader->firstByte >> 3) & 0x01); + return static_cast((pointers.fixedHeader->firstByte >> 3) & 0x01); } cfdp::TransmissionModes HeaderReader::getTransmissionMode() const { - return static_cast((fixedHeader->firstByte >> 2) & 0x01); + return static_cast((pointers.fixedHeader->firstByte >> 2) & 0x01); } -bool HeaderReader::getCrcFlag() const { return (fixedHeader->firstByte >> 1) & 0x01; } +bool HeaderReader::getCrcFlag() const { return (pointers.fixedHeader->firstByte >> 1) & 0x01; } -bool HeaderReader::getLargeFileFlag() const { return fixedHeader->firstByte & 0x01; } +bool HeaderReader::getLargeFileFlag() const { return pointers.fixedHeader->firstByte & 0x01; } cfdp::SegmentationControl HeaderReader::getSegmentationControl() const { - return static_cast((fixedHeader->fourthByte >> 7) & 0x01); + return static_cast((pointers.fixedHeader->fourthByte >> 7) & 0x01); } cfdp::WidthInBytes HeaderReader::getLenEntityIds() const { - return static_cast((fixedHeader->fourthByte >> 4) & 0x07); + return static_cast((pointers.fixedHeader->fourthByte >> 4) & 0x07); } cfdp::WidthInBytes HeaderReader::getLenSeqNum() const { - return static_cast(fixedHeader->fourthByte & 0x07); + return static_cast(pointers.fixedHeader->fourthByte & 0x07); } cfdp::SegmentMetadataFlag HeaderReader::getSegmentMetadataFlag() const { - return static_cast((fixedHeader->fourthByte >> 3) & 0x01); + return static_cast((pointers.fixedHeader->fourthByte >> 3) & 0x01); } void HeaderReader::getSourceId(cfdp::EntityId &sourceId) const { @@ -129,3 +130,8 @@ bool HeaderReader::hasSegmentMetadataFlag() const { ReturnValue_t HeaderReader::setData(const uint8_t *dataPtr, size_t maxSize_) { return setData(const_cast(dataPtr), maxSize_, nullptr); } +bool HeaderReader::isNull() const { + return pointers.rawPtr == nullptr or pointers.fixedHeader == nullptr; +} + +HeaderReader::operator bool() const { return isNull(); } diff --git a/src/fsfw/cfdp/pdu/HeaderReader.h b/src/fsfw/cfdp/pdu/HeaderReader.h index 67a0470a..a973a12e 100644 --- a/src/fsfw/cfdp/pdu/HeaderReader.h +++ b/src/fsfw/cfdp/pdu/HeaderReader.h @@ -42,6 +42,9 @@ class HeaderReader : public RedirectableDataPointerIF, public PduHeaderIF { * - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected */ virtual ReturnValue_t parseData(); + explicit operator bool() const; + [[nodiscard]] bool isNull() const; + [[nodiscard]] virtual size_t getHeaderSize() const; [[nodiscard]] size_t getPduDataFieldLen() const override; @@ -77,8 +80,12 @@ class HeaderReader : public RedirectableDataPointerIF, public PduHeaderIF { ReturnValue_t setData(const uint8_t* dataPtr, size_t maxSize); protected: - PduHeaderFixedStruct* fixedHeader = nullptr; - const uint8_t* rawPtr = nullptr; + struct Pointers { + PduHeaderFixedStruct* fixedHeader = nullptr; + const uint8_t* rawPtr = nullptr; + }; + + Pointers pointers; size_t maxSize = 0; private: diff --git a/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp b/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp index 3acf26a1..0b712fe1 100644 --- a/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/KeepAlivePduDeserializer.cpp @@ -11,7 +11,7 @@ ReturnValue_t KeepAlivePduDeserializer::parseData() { } size_t currentIdx = FileDirectiveReader::getHeaderSize(); size_t remLen = FileDirectiveReader::getWholePduSize() - currentIdx; - const uint8_t* buffer = rawPtr + currentIdx; + const uint8_t* buffer = pointers.rawPtr + currentIdx; return progress.deSerialize(&buffer, &remLen, getEndianness()); } diff --git a/src/fsfw/cfdp/pdu/MetadataPduReader.cpp b/src/fsfw/cfdp/pdu/MetadataPduReader.cpp index 29dc2e15..a7fc6d78 100644 --- a/src/fsfw/cfdp/pdu/MetadataPduReader.cpp +++ b/src/fsfw/cfdp/pdu/MetadataPduReader.cpp @@ -9,7 +9,7 @@ ReturnValue_t MetadataPduReader::parseData() { return result; } size_t currentIdx = FileDirectiveReader::getHeaderSize(); - const uint8_t* buf = rawPtr + currentIdx; + const uint8_t* buf = pointers.rawPtr + currentIdx; size_t remSize = FileDirectiveReader::getWholePduSize() - currentIdx; if (remSize < 1) { return SerializeIF::STREAM_TOO_SHORT; diff --git a/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp b/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp index a7f23996..089dc612 100644 --- a/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/NakPduDeserializer.cpp @@ -9,7 +9,7 @@ ReturnValue_t NakPduDeserializer::parseData() { return result; } size_t currentIdx = FileDirectiveReader::getHeaderSize(); - const uint8_t* buffer = rawPtr + currentIdx; + const uint8_t* buffer = pointers.rawPtr + currentIdx; size_t remSize = FileDirectiveReader::getWholePduSize() - currentIdx; if (remSize < 1) { return SerializeIF::STREAM_TOO_SHORT; diff --git a/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp b/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp index 833c9232..db57664d 100644 --- a/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp +++ b/src/fsfw/cfdp/pdu/PromptPduDeserializer.cpp @@ -16,6 +16,6 @@ ReturnValue_t PromptPduDeserializer::parseData() { return SerializeIF::STREAM_TOO_SHORT; } responseRequired = static_cast( - (rawPtr[FileDirectiveReader::getHeaderSize()] >> 7) & 0x01); + (pointers.rawPtr[FileDirectiveReader::getHeaderSize()] >> 7) & 0x01); return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/cfdp/tlv/Lv.cpp b/src/fsfw/cfdp/tlv/Lv.cpp index 1bb16301..09075094 100644 --- a/src/fsfw/cfdp/tlv/Lv.cpp +++ b/src/fsfw/cfdp/tlv/Lv.cpp @@ -6,6 +6,13 @@ cfdp::Lv::Lv(const uint8_t* value, size_t size) : value(value, size, true) { } } +cfdp::Lv::Lv(const char* value, size_t size) + : value(reinterpret_cast(value), size, true) { + if (size > 0) { + zeroLen = false; + } +} + cfdp::Lv::Lv() : value(static_cast(nullptr), 0, true) {} cfdp::Lv::Lv(const Lv& other) diff --git a/src/fsfw/cfdp/tlv/Lv.h b/src/fsfw/cfdp/tlv/Lv.h index 29764433..4a110f90 100644 --- a/src/fsfw/cfdp/tlv/Lv.h +++ b/src/fsfw/cfdp/tlv/Lv.h @@ -13,6 +13,7 @@ namespace cfdp { class Lv : public SerializeIF { public: Lv(const uint8_t* value, size_t size); + Lv(const char* value, size_t size); Lv(); // Delete copy ctor and assingment ctor for now because this class contains a reference to @@ -23,7 +24,7 @@ class Lv : public SerializeIF { ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const override; - size_t getSerializedSize() const override; + [[nodiscard]] size_t getSerializedSize() const override; /** * @brief Deserialize a LV field from a raw buffer diff --git a/src/fsfw/storagemanager/LocalPool.h b/src/fsfw/storagemanager/LocalPool.h index 1c1d4006..bf7ef92e 100644 --- a/src/fsfw/storagemanager/LocalPool.h +++ b/src/fsfw/storagemanager/LocalPool.h @@ -88,7 +88,7 @@ class LocalPool : public SystemObject, public StorageManagerIF { */ ReturnValue_t addData(store_address_t* storeId, const uint8_t* data, size_t size, bool ignoreFault = false) override; - ReturnValue_t getFreeElement(store_address_t* storeId, const size_t size, uint8_t** pData, + ReturnValue_t getFreeElement(store_address_t* storeId, size_t size, uint8_t** pData, bool ignoreFault = false) override; ConstAccessorPair getData(store_address_t storeId) override; diff --git a/unittests/cfdp/testDistributor.cpp b/unittests/cfdp/testDistributor.cpp index 4b8be8fe..9848bb73 100644 --- a/unittests/cfdp/testDistributor.cpp +++ b/unittests/cfdp/testDistributor.cpp @@ -12,9 +12,24 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") { auto queue = MessageQueueMock(1); CfdpDistribCfg distribCfg(1, pool, &queue); auto distributor = CfdpDistributor(distribCfg); - auto entityId = cfdp::EntityId(UnsignedByteField(2)); + auto obswEntityId = cfdp::EntityId(UnsignedByteField(2)); + auto groundEntityId = cfdp::EntityId(UnsignedByteField(1)); MessageQueueId_t acceptorQueueId = 3; auto tcAcceptor = AcceptsTcMock("TC Acceptor", 0, acceptorQueueId); + cfdp::FileSize fileSize(12); + const cfdp::EntityId& sourceId(groundEntityId); + const cfdp::EntityId& destId(obswEntityId); + cfdp::TransactionSeqNum seqNum(UnsignedByteField(12)); + auto pduConf = PduConfig(sourceId, destId, cfdp::TransmissionModes::UNACKNOWLEDGED, seqNum); + std::string sourceFileString = "hello.txt"; + cfdp::Lv sourceFileName(sourceFileString.c_str(), sourceFileString.size()); + std::string destFileString = "hello2.txt"; + cfdp::Lv destFileName(destFileString.c_str(), sourceFileString.size()); + MetadataInfo metadataInfo(false, cfdp::ChecksumType::CRC_32, fileSize, sourceFileName, + destFileName); + MetadataPduCreator creator(pduConf, metadataInfo); + uint8_t* dataPtr = nullptr; + SECTION("State") { CHECK(distributor.initialize() == result::OK); CHECK(std::strcmp(distributor.getName(), "CFDP Distributor") == 0); @@ -24,7 +39,14 @@ TEST_CASE("CFDP Distributor", "[cfdp][distributor]") { SECTION("Register Listener") { CHECK(distributor.initialize() == result::OK); - CHECK(distributor.registerTcDestination(entityId, tcAcceptor)); - // queue.addReceivedMessage() + CHECK(distributor.registerTcDestination(obswEntityId, tcAcceptor) == result::OK); + size_t serLen = 0; + store_address_t storeId; + CHECK(pool.getFreeElement(&storeId, creator.getSerializedSize(), &dataPtr) == result::OK); + REQUIRE(creator.SerializeIF::serializeBe(dataPtr, serLen, creator.getSerializedSize()) == + result::OK); + TmTcMessage msg(storeId); + queue.addReceivedMessage(msg); + CHECK(distributor.performOperation(0) == result::OK); } } \ No newline at end of file diff --git a/unittests/cfdp/testMetadataPdu.cpp b/unittests/cfdp/testMetadataPdu.cpp index 0992a3c2..19586604 100644 --- a/unittests/cfdp/testMetadataPdu.cpp +++ b/unittests/cfdp/testMetadataPdu.cpp @@ -22,7 +22,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { std::string firstFileName = "hello.txt"; cfdp::Lv sourceFileName(reinterpret_cast(firstFileName.data()), firstFileName.size()); - cfdp::Lv destFileName(nullptr, 0); + cfdp::Lv destFileName; FileSize fileSize(35); MetadataInfo info(false, ChecksumType::MODULAR, fileSize, sourceFileName, destFileName); @@ -72,7 +72,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { otherFileName.size()); info.setSourceFileName(otherFileNameLv); size_t sizeOfOptions = options.size(); - info.setOptionsArray(*options.data(), &sizeOfOptions, &sizeOfOptions); + info.setOptionsArray(options.data(), &sizeOfOptions, &sizeOfOptions); REQUIRE(info.getMaxOptionsLen() == 2); info.setMaxOptionsLen(3); REQUIRE(info.getMaxOptionsLen() == 3); @@ -130,7 +130,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { } size_t sizeOfOptions = options.size(); size_t maxSize = 4; - info.setOptionsArray(reinterpret_cast(options.data()), &sizeOfOptions, &maxSize); + info.setOptionsArray(options.data(), &sizeOfOptions, &maxSize); REQUIRE(info.getOptionsLen() == 2); info.setChecksumType(cfdp::ChecksumType::CRC_32C); info.setClosureRequested(true); @@ -169,7 +169,7 @@ TEST_CASE("Metadata PDU", "[cfdp][pdu]") { mdBuffer[2] = 36 & 0xff; info.setOptionsArray(nullptr, nullptr, nullptr); REQUIRE(deserializer2.parseData() == cfdp::METADATA_CANT_PARSE_OPTIONS); - info.setOptionsArray(reinterpret_cast(options.data()), &sizeOfOptions, nullptr); + info.setOptionsArray(options.data(), &sizeOfOptions, nullptr); for (size_t maxSz = 0; maxSz < 46; maxSz++) { MetadataPduReader invalidSzDeser(mdBuffer.data(), maxSz, info); result = invalidSzDeser.parseData(); diff --git a/unittests/cfdp/testTlvsLvs.cpp b/unittests/cfdp/testTlvsLvs.cpp index e311b5d6..acee9cce 100644 --- a/unittests/cfdp/testTlvsLvs.cpp +++ b/unittests/cfdp/testTlvsLvs.cpp @@ -158,7 +158,7 @@ TEST_CASE("CFDP TLV LV", "[cfdp]") { SerializeIF::Endianness::BIG); REQUIRE(sourceIdRaw == 0x0ff0); - auto lvEmpty = Lv(nullptr, 0); + auto lvEmpty = Lv(); REQUIRE(lvEmpty.getSerializedSize() == 1); serPtr = rawBuf.data(); deserSize = 0; @@ -191,7 +191,7 @@ TEST_CASE("CFDP TLV LV", "[cfdp]") { SerializeIF::Endianness::BIG); REQUIRE(sourceIdRaw == 0x0ff0); - auto lvEmpty = Lv(nullptr, 0); + auto lvEmpty = Lv(); REQUIRE(lvEmpty.getSerializedSize() == 1); serPtr = rawBuf.data(); deserSize = 0;