diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-03-19 12:30:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-19 12:30:01 -0700 |
commit | bce37d2785d508983f9d0501f6d711ef55ffc124 (patch) | |
tree | d2f7edaff548f6459bdf09d687a137b23a024ac3 /test | |
parent | 373866da41cf86ec23fa3420b08a3d0a55151b58 (diff) | |
parent | 0e2c6457d479be61275be5bd206ba5ab09a9ad86 (diff) |
Merge pull request #14464 from yashykt/socklent
Change size_t to socklen_t in resolve_address
Diffstat (limited to 'test')
-rw-r--r-- | test/core/end2end/goaway_server_test.cc | 2 | ||||
-rw-r--r-- | test/core/iomgr/sockaddr_utils_test.cc | 4 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_posix_test.cc | 6 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.cc | 14 | ||||
-rw-r--r-- | test/core/iomgr/udp_server_test.cc | 8 |
5 files changed, 17 insertions, 17 deletions
diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index 8ff14e2b85..0188698f17 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -82,7 +82,7 @@ static void my_resolve_address(const char* addr, const char* default_port, sa->sin_family = GRPC_AF_INET; sa->sin_addr.s_addr = 0x100007f; sa->sin_port = grpc_htons(static_cast<uint16_t>(g_resolve_port)); - (*addrs)->addrs[0].len = sizeof(*sa); + (*addrs)->addrs[0].len = static_cast<socklen_t>(sizeof(*sa)); gpr_mu_unlock(&g_mu); } GRPC_CLOSURE_SCHED(on_done, error); diff --git a/test/core/iomgr/sockaddr_utils_test.cc b/test/core/iomgr/sockaddr_utils_test.cc index aa9ece3081..3783f968b7 100644 --- a/test/core/iomgr/sockaddr_utils_test.cc +++ b/test/core/iomgr/sockaddr_utils_test.cc @@ -41,7 +41,7 @@ static grpc_resolved_address make_addr4(const uint8_t* data, size_t data_len) { GPR_ASSERT(data_len == sizeof(addr4->sin_addr.s_addr)); memcpy(&addr4->sin_addr.s_addr, data, data_len); addr4->sin_port = grpc_htons(12345); - resolved_addr4.len = sizeof(grpc_sockaddr_in); + resolved_addr4.len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in)); return resolved_addr4; } @@ -54,7 +54,7 @@ static grpc_resolved_address make_addr6(const uint8_t* data, size_t data_len) { GPR_ASSERT(data_len == sizeof(addr6->sin6_addr.s6_addr)); memcpy(&addr6->sin6_addr.s6_addr, data, data_len); addr6->sin6_port = grpc_htons(12345); - resolved_addr6.len = sizeof(grpc_sockaddr_in6); + resolved_addr6.len = static_cast<socklen_t>(sizeof(grpc_sockaddr_in6)); return resolved_addr6; } diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc index 8a43170043..a4c38af86f 100644 --- a/test/core/iomgr/tcp_client_posix_test.cc +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -89,7 +89,7 @@ void test_succeeds(void) { gpr_log(GPR_DEBUG, "test_succeeds"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; /* create a dummy server */ @@ -112,7 +112,7 @@ void test_succeeds(void) { /* await the connection */ do { - resolved_addr.len = sizeof(addr); + resolved_addr.len = static_cast<socklen_t>(sizeof(addr)); r = accept(svr_fd, reinterpret_cast<struct sockaddr*>(addr), reinterpret_cast<socklen_t*>(&resolved_addr.len)); } while (r == -1 && errno == EINTR); @@ -147,7 +147,7 @@ void test_fails(void) { gpr_log(GPR_DEBUG, "test_fails"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; gpr_mu_lock(g_mu); diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index dde77da547..d646df1dae 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -188,7 +188,7 @@ static void test_no_op_with_port(void) { LOG_TEST("test_no_op_with_port"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; int port = -1; GPR_ASSERT(grpc_tcp_server_add_port(s, &resolved_addr, &port) == @@ -209,7 +209,7 @@ static void test_no_op_with_port_and_start(void) { int port = -1; memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; GPR_ASSERT(grpc_tcp_server_add_port(s, &resolved_addr, &port) == GRPC_ERROR_NONE && @@ -314,8 +314,8 @@ static void test_connect(size_t num_connects, dst_addrs != nullptr ? "<specific>" : "::", test_dst_addrs); memset(&resolved_addr, 0, sizeof(resolved_addr)); memset(&resolved_addr1, 0, sizeof(resolved_addr1)); - resolved_addr.len = sizeof(struct sockaddr_storage); - resolved_addr1.len = sizeof(struct sockaddr_storage); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage)); + resolved_addr1.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage)); addr->ss_family = addr1->ss_family = AF_INET; GPR_ASSERT(GRPC_LOG_IF_ERROR( "grpc_tcp_server_add_port", @@ -387,7 +387,7 @@ static void test_connect(size_t num_connects, size_t connect_num; test_addr dst; GPR_ASSERT(fd >= 0); - dst.addr.len = sizeof(dst.addr.addr); + dst.addr.len = static_cast<socklen_t>(sizeof(dst.addr.addr)); GPR_ASSERT(getsockname(fd, (struct sockaddr*)dst.addr.addr, (socklen_t*)&dst.addr.len) == 0); GPR_ASSERT(dst.addr.len <= sizeof(dst.addr.addr)); @@ -460,10 +460,10 @@ int main(int argc, char** argv) { continue; } else if (ifa_it->ifa_addr->sa_family == AF_INET) { dst_addrs->addrs[dst_addrs->naddrs].addr.len = - sizeof(struct sockaddr_in); + static_cast<socklen_t>(sizeof(struct sockaddr_in)); } else if (ifa_it->ifa_addr->sa_family == AF_INET6) { dst_addrs->addrs[dst_addrs->naddrs].addr.len = - sizeof(struct sockaddr_in6); + static_cast<socklen_t>(sizeof(struct sockaddr_in6)); } else { continue; } diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc index 60f293972e..3058e87bea 100644 --- a/test/core/iomgr/udp_server_test.cc +++ b/test/core/iomgr/udp_server_test.cc @@ -210,7 +210,7 @@ static void test_no_op_with_port(void) { LOG_TEST("test_no_op_with_port"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size, snd_buf_size, &handler_factory)); @@ -241,7 +241,7 @@ static void test_no_op_with_port_and_socket_factory(void) { LOG_TEST("test_no_op_with_port_and_socket_factory"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size, snd_buf_size, &handler_factory)); @@ -268,7 +268,7 @@ static void test_no_op_with_port_and_start(void) { LOG_TEST("test_no_op_with_port_and_start"); memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_in); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_in)); addr->sin_family = AF_INET; GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size, snd_buf_size, &handler_factory)); @@ -301,7 +301,7 @@ static void test_receive(int number_of_clients) { g_number_of_orphan_calls = 0; memset(&resolved_addr, 0, sizeof(resolved_addr)); - resolved_addr.len = sizeof(struct sockaddr_storage); + resolved_addr.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage)); addr->ss_family = AF_INET; GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, rcv_buf_size, snd_buf_size, &handler_factory)); |