diff --git a/trunk/src/utest/srs_utest.hpp b/trunk/src/utest/srs_utest.hpp index 22d0d70e2..bf2f26c8a 100644 --- a/trunk/src/utest/srs_utest.hpp +++ b/trunk/src/utest/srs_utest.hpp @@ -67,7 +67,7 @@ extern srs_utime_t _srs_tmp_timeout; // For init array data. #define HELPER_ARRAY_INIT(buf, sz, val) \ - for (int i = 0; i < (int)sz; i++) (buf)[i]=val + memset(buf, val, sz) // Dump simple stream to string. #define HELPER_BUFFER2STR(io) \ diff --git a/trunk/src/utest/srs_utest_service.cpp b/trunk/src/utest/srs_utest_service.cpp index b4e85c591..e93816eab 100644 --- a/trunk/src/utest/srs_utest_service.cpp +++ b/trunk/src/utest/srs_utest_service.cpp @@ -1379,6 +1379,7 @@ VOID TEST(TCPServerTest, ContextUtility) int base_size = 0; if (true) { + errno = 0; int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0); ASSERT_TRUE(srs_log_header(buf, 1024, true, true, "SRS", "100", "Trace", &size)); base_size = size; @@ -1386,6 +1387,7 @@ VOID TEST(TCPServerTest, ContextUtility) } if (true) { + errno = 0; int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0); ASSERT_TRUE(srs_log_header(buf, 1024, false, true, "SRS", "100", "Trace", &size)); EXPECT_EQ(base_size, size); @@ -1399,6 +1401,7 @@ VOID TEST(TCPServerTest, ContextUtility) } if (true) { + errno = 0; int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0); ASSERT_TRUE(srs_log_header(buf, 1024, false, false, NULL, "100", "Trace", &size)); EXPECT_EQ(base_size - 8, size);