Cast string_copy return value to void (#2556)

This commit is contained in:
Thomas Boyer-Chammard 2024-03-04 22:30:26 -05:00 committed by GitHub
parent c830a41c85
commit c1d51d3f69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 77 additions and 77 deletions

View File

@ -30,7 +30,7 @@ int main(int argc, char* argv[]) {
addr = strtoul(optarg,0,0);
break;
case 'd':
Fw::StringUtils::string_copy(device, optarg, sizeof(device));
(void) Fw::StringUtils::string_copy(device, optarg, sizeof(device));
break;
default:
printf("test_ut %s\n",argv[0],help);

View File

@ -4,15 +4,15 @@
namespace Fw {
CmdStringArg::CmdStringArg(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
CmdStringArg::CmdStringArg(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
CmdStringArg::CmdStringArg(const CmdStringArg& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
CmdStringArg::CmdStringArg() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
CmdStringArg& CmdStringArg::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
LogStringArg::LogStringArg(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
LogStringArg::LogStringArg(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
LogStringArg::LogStringArg(const LogStringArg& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
LogStringArg::LogStringArg()
@ -25,7 +25,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -34,12 +34,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
LogStringArg& LogStringArg::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -3,15 +3,15 @@
namespace Fw {
TextLogString::TextLogString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
TextLogString::TextLogString(const StringBase& src): StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TextLogString::TextLogString(const TextLogString& src): StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TextLogString::TextLogString(): StringBase() {
@ -23,7 +23,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -32,12 +32,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
TextLogString& TextLogString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
ParamString::ParamString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
ParamString::ParamString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
ParamString::ParamString(const ParamString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
ParamString::ParamString() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
ParamString& ParamString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Test {
String::String(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
String::String(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
String::String(const String& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
String::String() : StringBase() {
@ -24,7 +24,7 @@ namespace Test {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Test {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
String& String::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
TlmString::TlmString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
TlmString::TlmString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TlmString::TlmString(const TlmString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TlmString::TlmString() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
TlmString& TlmString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
EightyCharString::EightyCharString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
EightyCharString::EightyCharString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
EightyCharString::EightyCharString(const EightyCharString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
EightyCharString::EightyCharString() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
EightyCharString& EightyCharString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
InternalInterfaceString::InternalInterfaceString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
InternalInterfaceString::InternalInterfaceString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
InternalInterfaceString::InternalInterfaceString(const InternalInterfaceString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
InternalInterfaceString::InternalInterfaceString() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
InternalInterfaceString& InternalInterfaceString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Fw {
String::String(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
String::String(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
String::String(const String& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
String::String() : StringBase() {
@ -24,7 +24,7 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
String& String::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -96,14 +96,14 @@ namespace Fw {
return *this;
}
Fw::StringUtils::string_copy(const_cast<char *>(this->toChar()), other.toChar(), this->getCapacity());
(void) Fw::StringUtils::string_copy(const_cast<char *>(this->toChar()), other.toChar(), this->getCapacity());
return *this;
}
// Copy constructor doesn't make sense in this virtual class as there is nothing to copy. Derived classes should
// call the empty constructor and then call their own copy function
StringBase& StringBase::operator=(const CHAR* other) { // lgtm[cpp/rule-of-two]
Fw::StringUtils::string_copy(const_cast<char *>(this->toChar()), other, this->getCapacity());
(void) Fw::StringUtils::string_copy(const_cast<char *>(this->toChar()), other, this->getCapacity());
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Os {
QueueString::QueueString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
QueueString::QueueString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
QueueString::QueueString(const QueueString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
QueueString::QueueString() : StringBase() {
@ -24,7 +24,7 @@ namespace Os {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Os {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
QueueString& QueueString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -4,15 +4,15 @@
namespace Os {
TaskString::TaskString(const char* src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
}
TaskString::TaskString(const StringBase& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TaskString::TaskString(const TaskString& src) : StringBase() {
Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
}
TaskString::TaskString() {
@ -24,7 +24,7 @@ namespace Os {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
@ -33,12 +33,12 @@ namespace Os {
return *this;
}
Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
return *this;
}
TaskString& TaskString::operator=(const char* other) {
Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
(void) Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
return *this;
}

View File

@ -107,7 +107,7 @@ namespace Svc {
"EVENT: (%d) (%d:%d,%d) %s: %s",
id,timeTag.getTimeBase(),timeTag.getSeconds(),timeTag.getUSeconds(),severityString,text.toChar());
ASSERT_EQ(0,strcmp(textStr,buf));
Fw::StringUtils::string_copy(oldLine, buf, sizeof(oldLine));
(void) Fw::StringUtils::string_copy(oldLine, buf, sizeof(oldLine));
}
}
stream1.close();
@ -210,7 +210,7 @@ namespace Svc {
"EVENT: (%d) (%d:%d,%d) %s: %s",
id,timeTag.getTimeBase(),timeTag.getSeconds(),timeTag.getUSeconds(),severityString,text.toChar());
ASSERT_EQ(0,strcmp(textStr,buf));
Fw::StringUtils::string_copy(oldLine, buf, sizeof(oldLine));
(void) Fw::StringUtils::string_copy(oldLine, buf, sizeof(oldLine));
}
}
stream1.close();

View File

@ -167,8 +167,8 @@ namespace Svc {
FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
(void) Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
(void) Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
Os::Queue::QueueStatus status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
@ -240,8 +240,8 @@ namespace Svc {
FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
(void) Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
(void) Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
Os::Queue::QueueStatus status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
@ -273,8 +273,8 @@ namespace Svc {
FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
FW_ASSERT(destFilename.length() < sizeof(entry.destFilename));
Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
(void) Fw::StringUtils::string_copy(entry.srcFilename, sourceFilename.toChar(), sizeof(entry.srcFilename));
(void) Fw::StringUtils::string_copy(entry.destFilename, destFilename.toChar(), sizeof(entry.destFilename));
Os::Queue::QueueStatus status = m_fileQueue.send(reinterpret_cast<U8*>(&entry), sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);