test: clean up not needed memset()
Use std::vector instead of a C array, where the elements are initialized with zero values by default. Change-Id: I3c69b588e2a2c3deba052eae35da87a3d085491e
This commit is contained in:
parent
c59bf4ed3a
commit
2ce1a7f61c
1 changed files with 4 additions and 5 deletions
|
@ -92,13 +92,12 @@ public:
|
|||
|
||||
bool expectString(const std::shared_ptr<Poco::Net::StreamSocket> &socket, const std::string& str)
|
||||
{
|
||||
char buffer[str.size() + 64];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
int got = socket->receiveBytes(buffer, str.size());
|
||||
std::vector<char> buffer(str.size() + 64);
|
||||
int got = socket->receiveBytes(buffer.data(), str.size());
|
||||
if (got != (int)str.size() ||
|
||||
strncmp(buffer, str.c_str(), got))
|
||||
strncmp(buffer.data(), str.c_str(), got))
|
||||
{
|
||||
std::cerr << "testChunks got " << got << " mismatching strings '" << buffer << " vs. expected '" << str << "'\n";
|
||||
std::cerr << "testChunks got " << got << " mismatching strings '" << buffer.data() << " vs. expected '" << str << "'\n";
|
||||
exitTest(TestResult::Failed);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue