mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix warning for comparing int with sizeof.
This commit is contained in:
parent
26284e368f
commit
0227e44ef0
4 changed files with 6 additions and 6 deletions
|
@ -184,7 +184,7 @@ srs_error_t SrsLatestVersion::start()
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
int r0 = snprintf(buf + i * 2, sizeof(buf) - i * 2, "%02x", uuid[i]);
|
int r0 = snprintf(buf + i * 2, sizeof(buf) - i * 2, "%02x", uuid[i]);
|
||||||
srs_assert(r0 > 0 && r0 < sizeof(buf) - i * 2);
|
srs_assert(r0 > 0 && r0 < (int)sizeof(buf) - i * 2);
|
||||||
}
|
}
|
||||||
server_id_ = buf;
|
server_id_ = buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,7 +436,7 @@ std::string SrsUdpMuxSocket::peer_id()
|
||||||
// Build the peer id, reserve 1 byte for the trailing '\0'.
|
// Build the peer id, reserve 1 byte for the trailing '\0'.
|
||||||
static char id_buf[128 + 1];
|
static char id_buf[128 + 1];
|
||||||
int len = snprintf(id_buf, sizeof(id_buf), "%s:%d", peer_ip.c_str(), peer_port);
|
int len = snprintf(id_buf, sizeof(id_buf), "%s:%d", peer_ip.c_str(), peer_port);
|
||||||
if (len <= 0 || len >= sizeof(id_buf)) {
|
if (len <= 0 || len >= (int)sizeof(id_buf)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
peer_id_ = string(id_buf, len);
|
peer_id_ = string(id_buf, len);
|
||||||
|
|
|
@ -171,7 +171,7 @@ srs_error_t srs_srt_listen(srs_srt_t srt_fd, std::string ip, int port)
|
||||||
|
|
||||||
char sport[8];
|
char sport[8];
|
||||||
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
||||||
srs_assert(r0 > 0 && r0 < sizeof(sport));
|
srs_assert(r0 > 0 && r0 < (int)sizeof(sport));
|
||||||
|
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
|
|
@ -176,7 +176,7 @@ srs_error_t srs_tcp_connect(string server, int port, srs_utime_t tm, srs_netfd_t
|
||||||
|
|
||||||
char sport[8];
|
char sport[8];
|
||||||
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
||||||
srs_assert(r0 > 0 && r0 < sizeof(sport));
|
srs_assert(r0 > 0 && r0 < (int)sizeof(sport));
|
||||||
|
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
@ -253,7 +253,7 @@ srs_error_t srs_tcp_listen(std::string ip, int port, srs_netfd_t* pfd)
|
||||||
|
|
||||||
char sport[8];
|
char sport[8];
|
||||||
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
||||||
srs_assert(r0 > 0 && r0 < sizeof(sport));
|
srs_assert(r0 > 0 && r0 < (int)sizeof(sport));
|
||||||
|
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
@ -315,7 +315,7 @@ srs_error_t srs_udp_listen(std::string ip, int port, srs_netfd_t* pfd)
|
||||||
|
|
||||||
char sport[8];
|
char sport[8];
|
||||||
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
int r0 = snprintf(sport, sizeof(sport), "%d", port);
|
||||||
srs_assert(r0 > 0 && r0 < sizeof(sport));
|
srs_assert(r0 > 0 && r0 < (int)sizeof(sport));
|
||||||
|
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue