diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
commit | 4f9b76b6f2acc4030ce9ef164322514c5d0e761b (patch) | |
tree | 9b993b3753affcbf164056826f9d568d8760b3a1 /network_io/win32 | |
parent | 961caf5f46055483fa72ab02f5e8baa16c209e2f (diff) | |
download | apr-4f9b76b6f2acc4030ce9ef164322514c5d0e761b.tar.gz |
Remove trailing whitespaces in *.c.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/win32')
-rw-r--r-- | network_io/win32/sendrecv.c | 48 | ||||
-rw-r--r-- | network_io/win32/sockets.c | 54 | ||||
-rw-r--r-- | network_io/win32/sockopt.c | 30 |
3 files changed, 66 insertions, 66 deletions
diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index b3e2a1c90..d98201746 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -25,10 +25,10 @@ #endif /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client - * in one call of TransmitFile. This number must be small enough to give the + * in one call of TransmitFile. This number must be small enough to give the * slowest client time to receive the data before the socket timeout triggers. * The same problem can exist with apr_socket_send(). In that case, we rely on - * the application to adjust socket timeouts and max send segment + * the application to adjust socket timeouts and max send segment * sizes appropriately. * For example, Apache will in most cases call apr_socket_send() with less * than 8193 bytes. @@ -61,7 +61,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -129,13 +129,13 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, + apr_int32_t flags, const char *buf, apr_size_t *len) { apr_ssize_t rv; - rv = sendto(sock->socketdes, buf, (int)*len, flags, - (const struct sockaddr*)&where->sa, + rv = sendto(sock->socketdes, buf, (int)*len, flags, + (const struct sockaddr*)&where->sa, where->salen); if (rv == SOCKET_ERROR) { *len = 0; @@ -147,23 +147,23 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, +APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, + apr_int32_t flags, char *buf, apr_size_t *len) { apr_ssize_t rv; from->salen = sizeof(from->sa); - rv = recvfrom(sock->socketdes, buf, (int)*len, flags, + rv = recvfrom(sock->socketdes, buf, (int)*len, flags, (struct sockaddr*)&from->sa, &from->salen); if (rv == SOCKET_ERROR) { (*len) = 0; return apr_get_netos_error(); } - apr_sockaddr_vars_set(from, from->sa.sin.sin_family, + apr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port)); (*len) = rv; @@ -175,8 +175,8 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, #if APR_HAS_SENDFILE -static apr_status_t collapse_iovec(char **off, apr_size_t *len, - struct iovec *iovec, int numvec, +static apr_status_t collapse_iovec(char **off, apr_size_t *len, + struct iovec *iovec, int numvec, char *buf, apr_size_t buflen) { if (numvec == 1) { @@ -206,9 +206,9 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, /* - * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, + * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, * apr_off_t *, apr_size_t *, apr_int32_t flags) - * Send a file from an open file descriptor to a socket, along with + * Send a file from an open file descriptor to a socket, along with * optional headers and trailers * arg 1) The socket to which we're writing * arg 2) The open file from which to read @@ -217,12 +217,12 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, * arg 5) Number of bytes to send out of the file * arg 6) APR flags that are mapped to OS specific flags */ -APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) + apr_int32_t flags) { apr_status_t status = APR_SUCCESS; apr_status_t rv; @@ -263,7 +263,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, * Long TransmitFile requests are defined as requests that require more * than a single read from the file or a cache; the request therefore * depends on the size of the file and the specified length of the send - * packet. + * packet. * * Use of TF_USE_KERNEL_APC can deliver significant performance benefits. * It is possible (though unlikely), however, that the thread in which @@ -281,7 +281,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { - rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); if (rv != APR_SUCCESS) return rv; @@ -304,8 +304,8 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, apr_size_t head_length = tfb.HeadLength; ptfb = &tfb; nbytes = 0; - rv = collapse_iovec((char **)&ptfb->Head, &head_length, - hdtr->headers, hdtr->numheaders, + rv = collapse_iovec((char **)&ptfb->Head, &head_length, + hdtr->headers, hdtr->numheaders, hdtrbuf, sizeof(hdtrbuf)); tfb.HeadLength = (DWORD)head_length; @@ -356,7 +356,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, sock->overlapped->Offset = (DWORD)(curoff); #if APR_HAS_LARGE_FILES sock->overlapped->OffsetHigh = (DWORD)(curoff >> 32); -#endif +#endif /* XXX BoundsChecker claims dwFlags must not be zero. */ rv = pfn_transmit_file(sock->socketdes, /* socket */ file->filehand, /* open file descriptor of the file to be sent */ @@ -368,10 +368,10 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, if (!rv) { status = apr_get_netos_error(); if ((status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) || - (status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) + (status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) { - rv = WaitForSingleObject(sock->overlapped->hEvent, - (DWORD)(sock->timeout >= 0 + rv = WaitForSingleObject(sock->overlapped->hEvent, + (DWORD)(sock->timeout >= 0 ? sock->timeout_ms : INFINITE)); if (rv == WAIT_OBJECT_0) { status = APR_SUCCESS; diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c index 8d7404df7..f94533c23 100644 --- a/network_io/win32/sockets.c +++ b/network_io/win32/sockets.c @@ -64,7 +64,7 @@ static void set_socket_vars(apr_socket_t *sock, int family, int type, int protoc apr_set_option(sock, APR_IPV6_V6ONLY, 1); } #endif -} +} static void alloc_socket(apr_socket_t **new, apr_pool_t *p) { *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t)); @@ -72,7 +72,7 @@ static void alloc_socket(apr_socket_t **new, apr_pool_t *p) (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, sizeof(apr_sockaddr_t)); (*new)->local_addr->pool = p; - + (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, sizeof(apr_sockaddr_t)); (*new)->remote_addr->pool = p; @@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock, } APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, - int type, int protocol, + int type, int protocol, apr_pool_t *cont) { DWORD flags; @@ -153,11 +153,11 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, (*new)->timeout = -1; (*new)->disconnected = 0; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; -} +} APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) @@ -199,8 +199,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { - if (bind(sock->socketdes, - (struct sockaddr *)&sa->sa, + if (bind(sock->socketdes, + (struct sockaddr *)&sa->sa, sa->salen) == -1) { return apr_get_netos_error(); } @@ -236,7 +236,7 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *p) { SOCKET s; @@ -255,10 +255,10 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, } alloc_socket(new, p); - set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, + set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); - (*new)->timeout = -1; + (*new)->timeout = -1; (*new)->disconnected = 0; (*new)->socketdes = s; @@ -269,8 +269,8 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, *(*new)->local_addr = *sock->local_addr; - /* The above assignment just overwrote the pool entry. Setting the local_addr - pool for the accepted socket back to what it should be. Otherwise all + /* The above assignment just overwrote the pool entry. Setting the local_addr + pool for the accepted socket back to what it should be. Otherwise all allocations for this socket will come from a server pool that is not freed until the process goes down.*/ (*new)->local_addr->pool = p; @@ -314,7 +314,7 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->local_interface_unknown = 1; } - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -360,7 +360,7 @@ static apr_status_t wait_for_connect(apr_socket_t *sock) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { apr_status_t rv; @@ -380,8 +380,8 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, if (rv == APR_FROM_OS_ERROR(WSAEWOULDBLOCK)) { if (sock->timeout == 0) { /* Tell the app that the connect is in progress... - * Gotta play some games here. connect on Unix will return - * EINPROGRESS under the same circumstances that Windows + * Gotta play some games here. connect on Unix will return + * EINPROGRESS under the same circumstances that Windows * returns WSAEWOULDBLOCK. Do some adhoc canonicalization... */ rv = APR_FROM_OS_ERROR(WSAEINPROGRESS); @@ -483,8 +483,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->disconnected = 0; (*apr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, - os_sock_info->local, + memcpy(&(*apr_sock)->local_addr->sa.sin, + os_sock_info->local, (*apr_sock)->local_addr->salen); (*apr_sock)->local_addr->pool = cont; /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ @@ -494,7 +494,7 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*apr_sock)->remote_addr->sa.sin, os_sock_info->remote, (*apr_sock)->remote_addr->salen); (*apr_sock)->remote_addr->pool = cont; @@ -502,8 +502,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->remote_addr->port = ntohs((*apr_sock)->remote_addr->sa.sin.sin_port); (*apr_sock)->remote_addr_unknown = 0; } - - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + + apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; @@ -533,14 +533,14 @@ APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, * This is not trivial to implement. */ -APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket) -{ +APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket) +{ return APR_ENOTIMPL; -} +} -APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket) -{ +APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket) +{ return APR_ENOTIMPL; -} +} APR_POOL_IMPLEMENT_ACCESSOR(socket); diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index 463eeebf5..780b5bd7b 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -69,15 +69,15 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva apr_set_option(sock, APR_SO_NONBLOCK, 0); } /* Reset socket timeouts if the new timeout differs from the old timeout */ - if (sock->timeout != t) + if (sock->timeout != t) { /* Win32 timeouts are in msec, represented as int */ sock->timeout_ms = (int)apr_time_as_msec(t); - setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, - (char *) &sock->timeout_ms, + setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, + (char *) &sock->timeout_ms, sizeof(sock->timeout_ms)); - setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, - (char *) &sock->timeout_ms, + setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, + (char *) &sock->timeout_ms, sizeof(sock->timeout_ms)); } } @@ -86,9 +86,9 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva /* Set the socket to blocking with infinite timeouts */ if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) return stat; - setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, + setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, (char *) &zero, sizeof(zero)); - setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, + setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, (char *) &zero, sizeof(zero)); } sock->timeout = t; @@ -107,7 +107,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, switch (opt) { case APR_SO_KEEPALIVE: if (on != apr_is_option_set(sock, APR_SO_KEEPALIVE)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -116,7 +116,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_DEBUG: if (on != apr_is_option_set(sock, APR_SO_DEBUG)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -137,7 +137,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_BROADCAST: if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -146,7 +146,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_REUSEADDR: if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -156,7 +156,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, case APR_SO_NONBLOCK: if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { - if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) + if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) return stat; } else { @@ -172,7 +172,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, struct linger li; li.l_onoff = on; li.l_linger = APR_MAX_SECS_TO_LINGER; - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) == -1) { return apr_get_netos_error(); } @@ -186,7 +186,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; - if (setsockopt(sock->socketdes, optlevel, optname, + if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_IPV6_V6ONLY: #if APR_HAVE_IPV6 - if (apr_os_level < APR_WIN_VISTA && + if (apr_os_level < APR_WIN_VISTA && sock->local_addr->family == AF_INET6) { /* apr_set_option() called at socket creation */ if (on) { |