mirror of
https://github.com/espressif/openthread.git
synced 2026-09-13 04:30:08 +00:00
[message] change 'Write()' to be a 'void' method (#5441)
This commit changes `Message::Write()` to return `void` instead of returning the number of bytes written. The `Write()` method does not resize the message and requires that the given data can be fully written into the message within its existing length. The `Write()` already contains an `OT_ASSERT()` to verify this. This commit also removes the redundant `OT_ASSERT()` checks in few places where `Write()` method's returned value was being used.
This commit is contained in:
@@ -61,7 +61,7 @@ void TestMessage(void)
|
||||
|
||||
VerifyOrQuit((message = messagePool->New(Message::kTypeIp6, 0)) != nullptr, "Message::New failed");
|
||||
SuccessOrQuit(message->SetLength(kMaxSize), "Message::SetLength failed");
|
||||
VerifyOrQuit(message->Write(0, kMaxSize, writeBuffer) == kMaxSize, "Message::Write failed");
|
||||
message->Write(0, kMaxSize, writeBuffer);
|
||||
VerifyOrQuit(message->Read(0, kMaxSize, readBuffer) == kMaxSize, "Message::Read failed");
|
||||
VerifyOrQuit(memcmp(writeBuffer, readBuffer, kMaxSize) == 0, "Message compare failed");
|
||||
VerifyOrQuit(message->GetLength() == kMaxSize, "Message::GetLength failed");
|
||||
@@ -75,7 +75,7 @@ void TestMessage(void)
|
||||
writeBuffer[offset + i]++;
|
||||
}
|
||||
|
||||
VerifyOrQuit(message->Write(offset, length, &writeBuffer[offset]) == length, "Message::Write failed");
|
||||
message->Write(offset, length, &writeBuffer[offset]);
|
||||
|
||||
VerifyOrQuit(message->Read(0, kMaxSize, readBuffer) == kMaxSize, "Message::Read failed");
|
||||
VerifyOrQuit(memcmp(writeBuffer, readBuffer, kMaxSize) == 0, "Message compare failed");
|
||||
|
||||
Reference in New Issue
Block a user