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:
Miklos Vajna 2019-11-25 08:28:03 +01:00
parent c59bf4ed3a
commit 2ce1a7f61c

View file

@ -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;
}