socket: Silence V641: buf size is not multiple of what it is cast to

This commit is contained in:
ZyX
2017-07-04 16:21:17 +03:00
parent 2e89aaf3bd
commit c930f32ab9

View File

@@ -105,9 +105,10 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb)
// contain 0 in this case, unless uv_tcp_getsockname() is used first.
uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas,
&(int){ sizeof(sas) });
uint16_t port = (uint16_t)((sas.ss_family == AF_INET)
? ((struct sockaddr_in *)&sas)->sin_port
: ((struct sockaddr_in6 *)&sas)->sin6_port);
uint16_t port = (uint16_t)(
(sas.ss_family == AF_INET)
? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port
: (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port);
// v:servername uses the string from watcher->addr
size_t len = strlen(watcher->addr);
snprintf(watcher->addr+len, sizeof(watcher->addr)-len, ":%" PRIu16,
@@ -247,7 +248,7 @@ tcp_retry:
uv_pipe_t *pipe = &stream->uv.pipe;
uv_pipe_init(&loop->uv, pipe, 0);
uv_pipe_connect(&req, pipe, address, connect_cb);
uv_stream = (uv_stream_t *)pipe;
uv_stream = STRUCT_CAST(uv_stream_t, pipe);
}
status = 1;
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, timeout, status != 1);