[Libreoffice-commits] online.git: test/UnitHTTP.cpp
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 25 07:28:31 UTC 2019
test/UnitHTTP.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
New commits:
commit 2ce1a7f61c370ecb2854ff069a3f0ea74d837c2f
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 25 08:28:03 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 25 08:28:12 2019 +0100
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
diff --git a/test/UnitHTTP.cpp b/test/UnitHTTP.cpp
index 060f0c3fa..6a9065864 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -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;
}
More information about the Libreoffice-commits
mailing list