Remove tabs and trailing whitespaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
4ffa6f83b9
commit
d84dd752ef
|
@ -319,7 +319,7 @@ typedef struct xcb_special_event xcb_special_event_t;
|
||||||
*/
|
*/
|
||||||
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
|
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
|
||||||
xcb_special_event_t *se);
|
xcb_special_event_t *se);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the next event from a special queue, blocking until one arrives
|
* @brief Returns the next event from a special queue, blocking until one arrives
|
||||||
*/
|
*/
|
||||||
|
@ -330,7 +330,6 @@ xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
|
||||||
*/
|
*/
|
||||||
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
|
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Listen for a special event
|
* @brief Listen for a special event
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,11 +89,11 @@ static int authnameslen[N_AUTH_PROTOS] = {
|
||||||
static size_t memdup(char **dst, void *src, size_t len)
|
static size_t memdup(char **dst, void *src, size_t len)
|
||||||
{
|
{
|
||||||
if(len)
|
if(len)
|
||||||
*dst = malloc(len);
|
*dst = malloc(len);
|
||||||
else
|
else
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
if(!*dst)
|
if(!*dst)
|
||||||
return 0;
|
return 0;
|
||||||
memcpy(*dst, src, len);
|
memcpy(*dst, src, len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,9 @@ static size_t memdup(char **dst, void *src, size_t len)
|
||||||
static int authname_match(enum auth_protos kind, char *name, size_t namelen)
|
static int authname_match(enum auth_protos kind, char *name, size_t namelen)
|
||||||
{
|
{
|
||||||
if(authnameslen[kind] != namelen)
|
if(authnameslen[kind] != namelen)
|
||||||
return 0;
|
return 0;
|
||||||
if(memcmp(authnames[kind], name, namelen))
|
if(memcmp(authnames[kind], name, namelen))
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ static void do_append(char *buf, int *idxp, void *val, size_t valsize) {
|
||||||
*idxp += valsize;
|
*idxp += valsize;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname)
|
static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname)
|
||||||
{
|
{
|
||||||
if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) {
|
if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) {
|
||||||
|
@ -195,22 +195,22 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
#ifdef HASXDMAUTH
|
#ifdef HASXDMAUTH
|
||||||
#define APPEND(buf,idx,val) do_append((buf),&(idx),&(val),sizeof(val))
|
#define APPEND(buf,idx,val) do_append((buf),&(idx),&(val),sizeof(val))
|
||||||
if (authname_match(AUTH_XA1, authptr->name, authptr->name_length)) {
|
if (authname_match(AUTH_XA1, authptr->name, authptr->name_length)) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
info->data = malloc(192 / 8);
|
info->data = malloc(192 / 8);
|
||||||
if(!info->data)
|
if(!info->data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (j = 0; j < 8; j++)
|
for (j = 0; j < 8; j++)
|
||||||
info->data[j] = authptr->data[j];
|
info->data[j] = authptr->data[j];
|
||||||
switch(sockname->sa_family) {
|
switch(sockname->sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
struct sockaddr_in *si = (struct sockaddr_in *) sockname;
|
struct sockaddr_in *si = (struct sockaddr_in *) sockname;
|
||||||
APPEND(info->data, j, si->sin_addr.s_addr);
|
APPEND(info->data, j, si->sin_addr.s_addr);
|
||||||
APPEND(info->data, j, si->sin_port);
|
APPEND(info->data, j, si->sin_port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
|
@ -235,26 +235,26 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
#endif
|
#endif
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
|
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
|
||||||
uint16_t fakeport = htons(getpid());
|
uint16_t fakeport = htons(getpid());
|
||||||
APPEND(info->data, j, fakeaddr);
|
APPEND(info->data, j, fakeaddr);
|
||||||
APPEND(info->data, j, fakeport);
|
APPEND(info->data, j, fakeport);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
free(info->data);
|
free(info->data);
|
||||||
return 0; /* do not know how to build this */
|
return 0; /* do not know how to build this */
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
uint32_t now = htonl(time(0));
|
uint32_t now = htonl(time(0));
|
||||||
APPEND(info->data, j, now);
|
APPEND(info->data, j, now);
|
||||||
}
|
}
|
||||||
assert(j <= 192 / 8);
|
assert(j <= 192 / 8);
|
||||||
while (j < 192 / 8)
|
while (j < 192 / 8)
|
||||||
info->data[j++] = 0;
|
info->data[j++] = 0;
|
||||||
info->datalen = j;
|
info->datalen = j;
|
||||||
XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
|
XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#undef APPEND
|
#undef APPEND
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,9 +270,9 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
(according to POSIX, applications should not assume a particular
|
(according to POSIX, applications should not assume a particular
|
||||||
length for `sockaddr_un.sun_path') */
|
length for `sockaddr_un.sun_path') */
|
||||||
static struct sockaddr *get_peer_sock_name(int (*socket_func)(int,
|
static struct sockaddr *get_peer_sock_name(int (*socket_func)(int,
|
||||||
struct sockaddr *,
|
struct sockaddr *,
|
||||||
socklen_t *),
|
socklen_t *),
|
||||||
int fd)
|
int fd)
|
||||||
{
|
{
|
||||||
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
|
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
|
||||||
socklen_t actual_socknamelen = socknamelen;
|
socklen_t actual_socknamelen = socknamelen;
|
||||||
|
|
|
@ -74,11 +74,11 @@ static int set_fd_flags(const int fd)
|
||||||
/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */
|
/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
|
u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ret = ioctlsocket(fd, FIONBIO, &iMode);
|
ret = ioctlsocket(fd, FIONBIO, &iMode);
|
||||||
if(ret != 0)
|
if(ret != 0)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
@ -195,8 +195,8 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
an iovec would require more work and I'm not sure of the benefit....works for now */
|
an iovec would require more work and I'm not sure of the benefit....works for now */
|
||||||
vec = *vector;
|
vec = *vector;
|
||||||
while(i < *count)
|
while(i < *count)
|
||||||
{
|
{
|
||||||
ret = send(c->fd,vec->iov_base,vec->iov_len,0);
|
ret = send(c->fd,vec->iov_base,vec->iov_len,0);
|
||||||
if(ret == SOCKET_ERROR)
|
if(ret == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
err = WSAGetLastError();
|
err = WSAGetLastError();
|
||||||
|
@ -212,7 +212,7 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
#else
|
#else
|
||||||
n = *count;
|
n = *count;
|
||||||
if (n > IOV_MAX)
|
if (n > IOV_MAX)
|
||||||
n = IOV_MAX;
|
n = IOV_MAX;
|
||||||
|
|
||||||
#if HAVE_SENDMSG
|
#if HAVE_SENDMSG
|
||||||
if (c->out.out_fd.nfd) {
|
if (c->out.out_fd.nfd) {
|
||||||
|
@ -250,7 +250,7 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
if(n <= 0)
|
if(n <= 0)
|
||||||
{
|
{
|
||||||
|
|
16
src/xcb_in.c
16
src/xcb_in.c
|
@ -200,9 +200,9 @@ static int read_packet(xcb_connection_t *c)
|
||||||
c->in.request_completed = c->in.request_read - 1;
|
c->in.request_completed = c->in.request_read - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(c->in.pending_replies &&
|
while(c->in.pending_replies &&
|
||||||
c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER &&
|
c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER &&
|
||||||
XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed))
|
XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed))
|
||||||
{
|
{
|
||||||
pending_reply *oldpend = c->in.pending_replies;
|
pending_reply *oldpend = c->in.pending_replies;
|
||||||
c->in.pending_replies = oldpend->next;
|
c->in.pending_replies = oldpend->next;
|
||||||
|
@ -386,11 +386,11 @@ static int read_block(const int fd, void *buf, const ssize_t len)
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(fd, &fds);
|
FD_SET(fd, &fds);
|
||||||
|
|
||||||
/* Initializing errno here makes sure that for Win32 this loop will execute only once */
|
/* Initializing errno here makes sure that for Win32 this loop will execute only once */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
do {
|
do {
|
||||||
ret = select(fd + 1, &fds, 0, 0, 0);
|
ret = select(fd + 1, &fds, 0, 0, 0);
|
||||||
} while (ret == -1 && errno == EINTR);
|
} while (ret == -1 && errno == EINTR);
|
||||||
#endif /* USE_POLL */
|
#endif /* USE_POLL */
|
||||||
}
|
}
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
|
@ -746,7 +746,7 @@ xcb_register_for_special_xge(xcb_connection_t *c,
|
||||||
pthread_mutex_unlock(&c->iolock);
|
pthread_mutex_unlock(&c->iolock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
se->extension = ext_reply->major_opcode;
|
se->extension = ext_reply->major_opcode;
|
||||||
se->eid = eid;
|
se->eid = eid;
|
||||||
|
|
||||||
|
|
|
@ -243,8 +243,8 @@ static int _xcb_open(const char *host, char *protocol, const int display)
|
||||||
free(file);
|
free(file);
|
||||||
|
|
||||||
if (fd < 0 && !protocol && *host == '\0') {
|
if (fd < 0 && !protocol && *host == '\0') {
|
||||||
unsigned short port = X_TCP_PORT + display;
|
unsigned short port = X_TCP_PORT + display;
|
||||||
fd = _xcb_open_tcp(host, protocol, port);
|
fd = _xcb_open_tcp(host, protocol, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
|
@ -261,10 +261,10 @@ static int _xcb_socket(int family, int type, int proto)
|
||||||
if (fd == -1 && errno == EINVAL)
|
if (fd == -1 && errno == EINVAL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fd = socket(family, type, proto);
|
fd = socket(family, type, proto);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
|
@ -272,15 +272,15 @@ static int _xcb_socket(int family, int type, int proto)
|
||||||
|
|
||||||
|
|
||||||
static int _xcb_do_connect(int fd, const struct sockaddr* addr, int addrlen) {
|
static int _xcb_do_connect(int fd, const struct sockaddr* addr, int addrlen) {
|
||||||
int on = 1;
|
int on = 1;
|
||||||
|
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
|
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
|
||||||
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
|
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
|
||||||
|
|
||||||
return connect(fd, addr, addrlen);
|
return connect(fd, addr, addrlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
|
static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
|
||||||
|
@ -295,13 +295,13 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
|
||||||
|
|
||||||
if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
|
if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
&& strcmp("inet6",protocol)
|
&& strcmp("inet6",protocol)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (*host == '\0')
|
if (*host == '\0')
|
||||||
host = "localhost";
|
host = "localhost";
|
||||||
|
|
||||||
#if HAVE_GETADDRINFO
|
#if HAVE_GETADDRINFO
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
@ -434,7 +434,7 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,
|
||||||
xcb_connection_t *c;
|
xcb_connection_t *c;
|
||||||
|
|
||||||
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
|
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
|
||||||
|
|
||||||
if(!parsed) {
|
if(!parsed) {
|
||||||
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR);
|
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
|
|
||||||
struct iovec {
|
struct iovec {
|
||||||
void *iov_base; /* Pointer to data. */
|
void *iov_base; /* Pointer to data. */
|
||||||
int iov_len; /* Length of data. */
|
int iov_len; /* Length of data. */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned int in_addr_t;
|
typedef unsigned int in_addr_t;
|
||||||
|
|
|
@ -53,7 +53,7 @@ enum lazy_reply_tag
|
||||||
|
|
||||||
#define XCB_PAD(i) (-(i) & 3)
|
#define XCB_PAD(i) (-(i) & 3)
|
||||||
|
|
||||||
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
|
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
|
||||||
|
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
#define offsetof(type,member) ((size_t) &((type *)0)->member)
|
#define offsetof(type,member) ((size_t) &((type *)0)->member)
|
||||||
|
@ -80,7 +80,7 @@ void *_xcb_map_remove(_xcb_map *q, unsigned int key);
|
||||||
/* xcb_out.c */
|
/* xcb_out.c */
|
||||||
|
|
||||||
#if HAVE_SENDMSG
|
#if HAVE_SENDMSG
|
||||||
#define XCB_MAX_PASS_FD 16
|
#define XCB_MAX_PASS_FD 16
|
||||||
|
|
||||||
typedef struct _xcb_fd {
|
typedef struct _xcb_fd {
|
||||||
int fd[XCB_MAX_PASS_FD];
|
int fd[XCB_MAX_PASS_FD];
|
||||||
|
|
Loading…
Reference in New Issue