From 61f62ceec6118fe0d3d412f49a1b4b1d969134bf Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 8 Jan 2021 11:48:56 +0800 Subject: [PATCH] Fix build warnings --- trunk/src/utest/srs_utest.hpp | 2 +- trunk/src/utest/srs_utest_http.cpp | 6 +++--- trunk/src/utest/srs_utest_kernel.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/trunk/src/utest/srs_utest.hpp b/trunk/src/utest/srs_utest.hpp index 551490127..5f30930b3 100644 --- a/trunk/src/utest/srs_utest.hpp +++ b/trunk/src/utest/srs_utest.hpp @@ -77,7 +77,7 @@ extern srs_utime_t _srs_tmp_timeout; // For init array data. #define HELPER_ARRAY_INIT(buf, sz, val) \ - for (int _iii = 0; _iii < sz; _iii++) (buf)[_iii] = val + for (int _iii = 0; _iii < (int)sz; _iii++) (buf)[_iii] = val // Dump simple stream to string. #define HELPER_BUFFER2STR(io) \ diff --git a/trunk/src/utest/srs_utest_http.cpp b/trunk/src/utest/srs_utest_http.cpp index 8d52bad44..c5dfea841 100644 --- a/trunk/src/utest/srs_utest_http.cpp +++ b/trunk/src/utest/srs_utest_http.cpp @@ -1966,7 +1966,7 @@ VOID TEST(ProtocolHTTPTest, QueryEscape) {"a%20b", "a b", srs_success} }; - for(int i = 0; i < (sizeof(unescape) / sizeof(struct EscapeTest)); ++i) { + for(int i = 0; i < (int)(sizeof(unescape) / sizeof(struct EscapeTest)); ++i) { struct EscapeTest& d = unescape[i]; string value; if(srs_success == d.err) { @@ -1988,7 +1988,7 @@ VOID TEST(ProtocolHTTPTest, QueryEscape) {" ?&=#+%!<>#\"{}|\\^[]`☺\t:/@$'()*,;", "+%3F%26%3D%23%2B%25%21%3C%3E%23%22%7B%7D%7C%5C%5E%5B%5D%60%E2%98%BA%09%3A%2F%40%24%27%28%29%2A%2C%3B", srs_success}, }; - for(int i = 0; i < (sizeof(escape) / sizeof(struct EscapeTest)); ++i) { + for(int i = 0; i < (int)(sizeof(escape) / sizeof(struct EscapeTest)); ++i) { struct EscapeTest& d = escape[i]; EXPECT_STREQ(d.out.c_str(), SrsHttpUri::query_escape(d.in).c_str()); @@ -2014,7 +2014,7 @@ VOID TEST(ProtocolHTTPTest, PathEscape) srs_success}, }; - for(int i = 0; i < (sizeof(path) / sizeof(struct EscapeTest)); ++i) { + for(int i = 0; i < (int)(sizeof(path) / sizeof(struct EscapeTest)); ++i) { struct EscapeTest& d = path[i]; EXPECT_STREQ(d.out.c_str(), SrsHttpUri::path_escape(d.in).c_str()); diff --git a/trunk/src/utest/srs_utest_kernel.cpp b/trunk/src/utest/srs_utest_kernel.cpp index 79d61bb4a..ae27d5858 100644 --- a/trunk/src/utest/srs_utest_kernel.cpp +++ b/trunk/src/utest/srs_utest_kernel.cpp @@ -2440,7 +2440,7 @@ VOID TEST(KernelUtility, Base64) {"Twas brillig, and the slithy toves", "VHdhcyBicmlsbGlnLCBhbmQgdGhlIHNsaXRoeSB0b3Zlcw=="} }; - for(int i = 0; i < (sizeof(data) / sizeof(struct testpair)); ++i) { + for(int i = 0; i < (int)(sizeof(data) / sizeof(struct testpair)); ++i) { struct testpair& d = data[i]; string cipher; HELPER_EXPECT_SUCCESS(srs_av_base64_encode(d.decoded, cipher));