Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to FPP v2.1.0a10 #2703

Closed
wants to merge 142 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
6de63cc
Revise Linux platform types
bocchino Dec 7, 2022
980a26f
Fix regression in test autocoder
bocchino Dec 8, 2022
91b6c01
Revise test autocoder
bocchino Dec 8, 2022
7504de2
Revise test autocoder
bocchino Dec 8, 2022
ecf4cb7
Fix integer type mismatch in ComQueue
bocchino Dec 8, 2022
253540d
Merge branch 'linux-platform' into devel
bocchino Dec 12, 2022
31e315d
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 3, 2023
f60e88e
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 25, 2023
2204a0c
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Feb 7, 2023
8b41def
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Feb 15, 2023
2bad0d6
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Mar 3, 2023
fc0317e
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Apr 3, 2023
66a8190
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Apr 10, 2023
8e6412a
Merge branch 'nasa:devel' into devel
bocchino May 4, 2023
949a251
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jul 18, 2023
6fc15e9
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jul 18, 2023
e961a4d
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jul 26, 2023
b00486a
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Aug 1, 2023
6f999de
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Aug 9, 2023
08f7ee1
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Sep 25, 2023
b2f54cf
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Oct 9, 2023
6fcbc51
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Oct 11, 2023
0d4cf3d
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Oct 19, 2023
6514547
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Nov 7, 2023
6f3ae9f
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Nov 16, 2023
89c0e35
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Nov 28, 2023
cdc83ea
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Nov 29, 2023
4a46719
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Dec 5, 2023
7acf774
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Dec 14, 2023
ac20f12
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 2, 2024
50b543b
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 11, 2024
2bff088
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 19, 2024
29ef16e
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Jan 25, 2024
51c3884
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Feb 20, 2024
07d28a7
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Feb 26, 2024
7e98d5b
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Feb 28, 2024
411e09a
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Mar 5, 2024
e864b01
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Mar 7, 2024
7140d75
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Mar 12, 2024
476ba08
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Apr 8, 2024
8cb7700
Merge remote-tracking branch 'upstream/devel' into devel
bocchino Apr 9, 2024
4359574
Update fpp version
bocchino Apr 9, 2024
5f41b0c
Update fpp version
bocchino Apr 9, 2024
d8bf071
Revise DpWriter unit tests
bocchino Apr 9, 2024
b7d3a7d
Update fpp version
bocchino Apr 9, 2024
c3e0aa2
Update fpp version
bocchino Apr 10, 2024
9e04083
Revise DpTest
bocchino Apr 10, 2024
fb44afb
Reivse StringType; add ExternalString
bocchino Apr 10, 2024
eee3ec3
Merge branch 'fpp-issue-398-default-priority' into fpp-issue-392-stri…
bocchino Apr 10, 2024
b1fc19b
Revise dp test
bocchino Apr 10, 2024
800de25
Revise dp test; update fpp version
bocchino Apr 10, 2024
be54883
Revise dp test
bocchino Apr 10, 2024
c0d626a
Revise dp test
bocchino Apr 10, 2024
d4121f7
Revise dp test
bocchino Apr 10, 2024
2e3e2ef
Revise dp test
bocchino Apr 10, 2024
021e0fc
Revise dp test
bocchino Apr 11, 2024
29031f7
Revise dp test
bocchino Apr 11, 2024
03326c6
Revise dp test
bocchino Apr 11, 2024
ce90192
Revise dp test
bocchino Apr 11, 2024
4c66664
Revise dp test
bocchino Apr 11, 2024
864f15a
Merge remote-tracking branch 'upstream/devel' into fpp-issue-397-from…
bocchino Apr 11, 2024
4402937
Merge remote-tracking branch 'upstream/devel' into fpp-issue-398-defa…
bocchino Apr 11, 2024
ea00253
Merge branch 'fpp-issue-398-default-priority' into fpp-issues-397-398
bocchino Apr 11, 2024
738936f
Revise fpp version
bocchino Apr 11, 2024
3b98052
Update fpp version
bocchino Apr 11, 2024
457fc35
Merge branch 'fpp-v2.1.0a7' into fpp-issue-392-string-records
bocchino Apr 11, 2024
4ea55a6
Revise ExternalString
bocchino Apr 11, 2024
48ad464
Reformat Fw/Serializable.{hpp,cpp}
bocchino Apr 11, 2024
772cc57
Reformat StringType.{hpp,cpp}
bocchino Apr 11, 2024
8f26567
Revise StringBase
bocchino Apr 11, 2024
fff0ad6
Update fpp version
bocchino Apr 11, 2024
8f8efe0
Remove trailing space
bocchino Apr 12, 2024
e8586e6
Reformat code
bocchino Apr 12, 2024
c4b9b9a
Revise dp test
bocchino Apr 12, 2024
171781b
Reformat cpp and hpp files in Fw/Types
bocchino Apr 12, 2024
aafbd6e
Revise string types
bocchino Apr 12, 2024
94b3d32
Merge branch 'format-fw-types' into external-string
bocchino Apr 12, 2024
00fb983
Revise string types
bocchino Apr 12, 2024
4c2ad7c
Revise string types
bocchino Apr 12, 2024
e536e88
Remove EightyCharString
bocchino Apr 12, 2024
9eaec83
Revise CmdString
bocchino Apr 12, 2024
91e78f9
Revise LogString
bocchino Apr 12, 2024
24a9242
Revise PrmString
bocchino Apr 12, 2024
e078a59
Revise TextLogString
bocchino Apr 12, 2024
33d7c75
Revise Test/String
bocchino Apr 12, 2024
d3c59db
Revise TlmString
bocchino Apr 12, 2024
d5c4cb2
Revise InternalInterfaceString
bocchino Apr 12, 2024
480e9d3
Revise Os/QueueString
bocchino Apr 12, 2024
5b9a4de
Revise Os/TaskString
bocchino Apr 12, 2024
10dce0c
Add missing type qualifier
bocchino Apr 13, 2024
5fd6b34
Fix warning in String.hpp
bocchino Apr 13, 2024
058e402
Revise string types
bocchino Apr 13, 2024
a6d2b43
Remove stray character
bocchino Apr 13, 2024
ce0616a
Revise StringBase
bocchino Apr 13, 2024
028ac4b
Revise string types
bocchino Apr 13, 2024
4e7ab41
Revise String type
bocchino Apr 13, 2024
ac44ee8
Revise FileNameString
bocchino Apr 13, 2024
3e589a9
Revise string types
bocchino Apr 13, 2024
a215ab7
Add missing file
bocchino Apr 13, 2024
74a2c37
Revise InternalInterfaceString
bocchino Apr 13, 2024
883e8a9
Revise comment
bocchino Apr 13, 2024
9af1b1d
Revise TlmString
bocchino Apr 13, 2024
3628e98
Revise string types
bocchino Apr 13, 2024
6ab639a
Revise log strings
bocchino Apr 13, 2024
9fea2d7
Revise PrmString
bocchino Apr 13, 2024
1d74568
Revise Os string classes
bocchino Apr 13, 2024
ad5a348
Revise string types
bocchino Apr 13, 2024
84c7b54
Revise string types
bocchino Apr 13, 2024
77e1a3b
Revise os strings
bocchino Apr 13, 2024
fe5f6b9
Add test for ExternalString to TypesTest
bocchino Apr 13, 2024
a616fc2
Revise ExternalString
bocchino Apr 13, 2024
4db1eb0
Revise ExternalString
bocchino Apr 13, 2024
d3efd31
Update fpp version
bocchino Apr 13, 2024
85c29f7
Format Fw/Types
bocchino Apr 13, 2024
047d8b7
Merge branch 'format-fw-types' into fpp-issue-392-string-records
bocchino Apr 13, 2024
20a00c5
Merge branch 'external-string' into fpp-issue-392-string-records
bocchino Apr 13, 2024
9c575eb
Merge remote-tracking branch 'upstream/devel' into external-string
bocchino Apr 15, 2024
0df9a5b
Merge remote-tracking branch 'upstream/devel' into fpp-issue-407-dict…
bocchino Apr 15, 2024
3b41536
Add static serialized size to StringBase
bocchino Apr 16, 2024
941177b
Merge branch 'fpp-issue-392-string-records' into fpp-issue-407-dictio…
bocchino Apr 16, 2024
f0bd736
Update fpp version
bocchino Apr 16, 2024
b8edffc
Update fpp version; revise string classes
bocchino Apr 16, 2024
f09e8dd
Revise event handling in DpWriter
bocchino Apr 16, 2024
7c92d35
Revise string implementations
bocchino Apr 16, 2024
97b6985
Revise string implementations
bocchino Apr 16, 2024
1e774be
Refactor dp tests
bocchino Apr 16, 2024
c8941b4
Add static assertion to PrmBuffer
bocchino Apr 16, 2024
4416cc4
Revise string implementations; update fpp version
bocchino Apr 17, 2024
aa8f4fd
Revise StringBase
bocchino Apr 17, 2024
36662ab
Fix tests to conform to FPP changes
bocchino Apr 17, 2024
1c466ba
Merge branch 'external-string' into fpp-issue-392-string-records
bocchino Apr 17, 2024
5cd2f82
Merge branch 'fpp-issue-392-string-records' into fpp-issue-407-dictio…
bocchino Apr 17, 2024
0989621
Merge remote-tracking branch 'upstream/devel' into fpp-issue-392-stri…
bocchino Apr 18, 2024
e3f3f49
Merge branch 'fpp-issue-392-string-records' into fpp-issue-407-dictio…
bocchino Apr 18, 2024
1d99954
Merge remote-tracking branch 'upstream/devel' into fpp-issue-407-dict…
bocchino Apr 26, 2024
3e91a02
Remove helper scripts
bocchino Apr 26, 2024
48b051c
Add const qualifier
bocchino Apr 26, 2024
00a3e0c
Revise StringBase
bocchino Apr 26, 2024
4a5ae70
Revise StringBase
bocchino Apr 26, 2024
3cffcd0
Revise comment
bocchino Apr 26, 2024
5c9495b
Update fpp version
bocchino Apr 27, 2024
84d5c1f
Fix code formatting
bocchino Apr 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions FppTest/dp/test/ut/Tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,7 @@ Fw::Time Tester::randomizeTestTime() {
}

void Tester::generateRandomString(Fw::StringBase& str) {
// Reserve enough space for max length plus null terminator
char buffer[MAX_STRING_LENGTH + 1];
char buffer[Fw::StringBase::BUFFER_SIZE(MAX_STRING_LENGTH)];
// Pick a random string length
const FwSizeType length = STest::Pick::lowerUpper(0, MAX_STRING_LENGTH);
// Fill buffer with a random null-terminated string with that length
Expand Down
4 changes: 2 additions & 2 deletions Fw/Cmd/CmdString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_STR,
STRING_SIZE = FW_CMD_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE),
};

CmdStringArg() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[CmdStringArg::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Log/LogString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_LOG_STR,
STRING_SIZE = FW_LOG_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

LogStringArg() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[LogStringArg::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Log/TextLogString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_LOG_STR,
STRING_SIZE = FW_LOG_TEXT_BUFFER_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

TextLogString() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[TextLogString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
6 changes: 6 additions & 0 deletions Fw/Prm/PrmBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
#include <Fw/Types/Serializable.hpp>
#include <Fw/Cfg/SerIds.hpp>

#include "Fw/Types/StringBase.hpp"


namespace Fw {

static_assert(FW_PARAM_BUFFER_MAX_SIZE >= StringBase::BUFFER_SIZE(FW_PARAM_STRING_MAX_SIZE),
"param string must fit into param buffer");

class ParamBuffer : public SerializeBufferBase {
public:

Expand Down
4 changes: 2 additions & 2 deletions Fw/Prm/PrmString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ParamString : public StringBase {
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_PRM_STR,
STRING_SIZE = FW_PARAM_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

ParamString() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@ class ParamString : public StringBase {
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[ParamString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Test/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public:
enum {
STRING_SIZE = 256,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE),
};

String() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -49,7 +49,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[String::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Tlm/TlmString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_TLM_STR,
STRING_SIZE = FW_TLM_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

TlmString() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[TlmString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Types/FileNameString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_FILE_NAME_STRING,
STRING_SIZE = FileNameStringSize,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

FileNameString() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -53,7 +53,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[FileNameString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Types/InternalInterfaceString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_INTERNAL_INTERFACE_STRING,
STRING_SIZE = FW_INTERNAL_INTERFACE_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

InternalInterfaceString() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -53,7 +53,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[InternalInterfaceString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Types/ObjectName.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_OBJECT_NAME,
STRING_SIZE = FW_OBJ_NAME_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE)
};

ObjectName() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[ObjectName::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
4 changes: 2 additions & 2 deletions Fw/Types/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_FIXED_LENGTH_STRING,
STRING_SIZE = FW_FIXED_LENGTH_STRING_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE),
};

String() : StringBase() { *this = ""; }
Expand Down Expand Up @@ -52,7 +52,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[String::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Fw

Expand Down
41 changes: 34 additions & 7 deletions Fw/Types/StringBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,16 @@
}

StringBase::SizeType StringBase::length() const {
return static_cast<SizeType>(StringUtils::string_length(this->toChar(), this->getCapacity()));
const SizeType length = static_cast<SizeType>(StringUtils::string_length(this->toChar(), this->getCapacity()));

Check notice

Code scanning / CodeQL

Use of basic integral type Note

length uses the basic integral type unsigned int rather than a typedef with size and signedness.
FW_ASSERT(length <= this->maxLength(), static_cast<FwAssertArgType>(length),
static_cast<FwAssertArgType>(this->maxLength()));
return length;
}

StringBase::SizeType StringBase::maxLength() const {

Check notice

Code scanning / CodeQL

Use of basic integral type Note

maxLength uses the basic integral type unsigned int rather than a typedef with size and signedness.
const SizeType capacity = this->getCapacity();

Check notice

Code scanning / CodeQL

Use of basic integral type Note

capacity uses the basic integral type unsigned int rather than a typedef with size and signedness.
FW_ASSERT(capacity > 0, static_cast<FwAssertArgType>(capacity));
return capacity - 1;
}

StringBase::SizeType StringBase::serializedSize() const {
Expand All @@ -130,16 +139,34 @@
}

SerializeStatus StringBase::serialize(SerializeBufferBase& buffer, SizeType maxLength) const {
SizeType len = FW_MIN(maxLength, this->length());
return buffer.serialize(reinterpret_cast<const U8*>(this->toChar()), len);
const FwSizeType len = FW_MIN(maxLength, this->length());

Check notice

Code scanning / CodeQL

Use of basic integral type Note

len uses the basic integral type unsigned long rather than a typedef with size and signedness.
// Serialize length and then bytes
return buffer.serialize(reinterpret_cast<const U8*>(this->toChar()), len, Serialization::INCLUDE_LENGTH);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter buffer has not been checked.
}

SerializeStatus StringBase::deserialize(SerializeBufferBase& buffer) {
SizeType maxSize = this->getCapacity() - 1;
// Get the max size of the deserialized string
const FwSizeType maxSize = this->maxLength();

Check notice

Code scanning / CodeQL

Use of basic integral type Note

maxSize uses the basic integral type unsigned long rather than a typedef with size and signedness.
// Initial estimate of actual size is max size
// This estimate is refined when calling the deserialize function below
SizeType actualSize = maxSize;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

actualSize uses the basic integral type unsigned int rather than a typedef with size and signedness.
// Public interface returns const char*, but implementation needs char*
// So use const_cast
CHAR* raw = const_cast<CHAR*>(this->toChar());
SerializeStatus stat = buffer.deserialize(reinterpret_cast<U8*>(raw), maxSize);
// Null terminate deserialized string
raw[maxSize] = 0;
// Deserialize length
// Fail if length exceeds max size (the initial value of actualSize)
// Otherwise deserialize length bytes and set actualSize to length
SerializeStatus stat = buffer.deserialize(reinterpret_cast<U8*>(raw), actualSize, Serialization::INCLUDE_LENGTH);

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter buffer has not been checked.
if (stat == FW_SERIALIZE_OK) {
// Deserialization succeeded: null-terminate string at actual size
FW_ASSERT(actualSize <= maxSize, static_cast<FwAssertArgType>(actualSize),
static_cast<FwAssertArgType>(maxSize));
raw[actualSize] = 0;
} else {
// Deserialization failed: leave string unmodified, but ensure that it
// is null-terminated
raw[0] = maxSize;
}
return stat;
}
} // namespace Fw
28 changes: 25 additions & 3 deletions Fw/Types/StringBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,31 @@
virtual const CHAR* toChar() const = 0; //<! Convert to a C-style char*
virtual SizeType getCapacity() const = 0; //!< return size of buffer
SizeType length() const; //!< Get length of string
SizeType serializedSize() const; //!< Get length of string plus size of stored size
SizeType serializedTruncatedSize(
FwSizeType maxLength) const; //!< Get truncated length of string plus size of stored size

//! Get the maximum length of a string that the buffer can hold
SizeType maxLength() const;
//! Get the static serialized size of a string
//! This is the max length of the string plus the size of the stored size
static constexpr FwSizeType STATIC_SERIALIZED_SIZE(FwSizeType maxLength //!< The maximum string length

Check notice

Code scanning / CodeQL

Use of basic integral type Note

STATIC_SERIALIZED_SIZE uses the basic integral type unsigned long rather than a typedef with size and signedness.

Check notice

Code scanning / CodeQL

Use of basic integral type Note

maxLength uses the basic integral type unsigned long rather than a typedef with size and signedness.
) {
return sizeof(FwSizeStoreType) + maxLength;
}

//! Get the size of a null-terminated string buffer
static constexpr FwSizeType BUFFER_SIZE(FwSizeType maxLength //!< The maximum string length

Check notice

Code scanning / CodeQL

Use of basic integral type Note

BUFFER_SIZE uses the basic integral type unsigned long rather than a typedef with size and signedness.

Check notice

Code scanning / CodeQL

Use of basic integral type Note

maxLength uses the basic integral type unsigned long rather than a typedef with size and signedness.
) {
// Reserve one byte for each character plus one for the null terminator
return maxLength + 1;
}

//! Get the dynamic serialized size of a string
//! This is the length of the string plus the size of the stored size
SizeType serializedSize() const;

//! Get the serialized truncated size of a string
//! This is the minimum of the dynamic serialized size and the max length
SizeType serializedTruncatedSize(FwSizeType maxLength //!< The max string length
) const;

const CHAR* operator+=(const CHAR* src); //!< Concatenate a CHAR*
const StringBase& operator+=(const StringBase& src); //!< Concatenate a StringBase
Expand Down
4 changes: 2 additions & 2 deletions Os/QueueString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class QueueString final : public Fw::StringBase {
public:
enum { STRING_SIZE = FW_QUEUE_NAME_MAX_SIZE, SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType) };
enum { STRING_SIZE = FW_QUEUE_NAME_MAX_SIZE, SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE) };

QueueString() : StringBase() { *this = ""; }

Expand Down Expand Up @@ -47,7 +47,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[QueueString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Os

Expand Down
4 changes: 2 additions & 2 deletions Os/TaskString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class TaskString final : public Fw::StringBase {
public:
enum { STRING_SIZE = FW_TASK_NAME_MAX_SIZE, SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType) };
enum { STRING_SIZE = FW_TASK_NAME_MAX_SIZE, SERIALIZED_SIZE = STATIC_SERIALIZED_SIZE(STRING_SIZE) };

TaskString() : StringBase() { *this = ""; }

Expand Down Expand Up @@ -47,7 +47,7 @@
StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

private:
char m_buf[TaskString::STRING_SIZE];
char m_buf[BUFFER_SIZE(STRING_SIZE)];

Check notice

Code scanning / CodeQL

Use of basic integral type Note

m_buf uses the basic integral type char rather than a typedef with size and signedness.
};
} // namespace Os

Expand Down
10 changes: 5 additions & 5 deletions Svc/BufferLogger/test/ut/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace Svc {
//! Run a test
void test(
const U32 numFiles, //!< The number of files to create
const char *const baseName //!< The baseName to use
const Fw::CmdStringArg& baseName //!< The baseName to use
) {
this->sendCmd_BL_OpenFile(0, 0, baseName);
this->dispatchOne();
Expand All @@ -105,7 +105,7 @@ namespace Svc {
currentFileName.format(
"%s%s%s",
this->component.m_file.m_prefix.toChar(),
baseName,
baseName.toChar(),
this->component.m_file.m_suffix.toChar()
);
this->sendBuffers(1);
Expand All @@ -123,7 +123,7 @@ namespace Svc {
currentFileName.format(
"%s%s%d%s",
this->component.m_file.m_prefix.toChar(),
baseName,
baseName.toChar(),
i,
this->component.m_file.m_suffix.toChar()
);
Expand All @@ -147,15 +147,15 @@ namespace Svc {
fileName.format(
"%s%s%s",
this->component.m_file.m_prefix.toChar(),
baseName,
baseName.toChar(),
this->component.m_file.m_suffix.toChar()
);
}
else {
fileName.format(
"%s%s%d%s",
this->component.m_file.m_prefix.toChar(),
baseName,
baseName.toChar(),
i,
this->component.m_file.m_suffix.toChar()
);
Expand Down