@@ -21,6 +21,7 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stddef.h> | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
@@ -122,7 +123,7 @@ int send_event(caca_event_t ev, struct screen_list *screen_list) | |||||
} | } | ||||
if (bytes) | if (bytes) | ||||
{ | { | ||||
ssize_t r; | |||||
ptrdiff_t r; | |||||
buf[bytes] = '\0'; | buf[bytes] = '\0'; | ||||
debug("Sending '%s', %d bytes", buf, bytes); | debug("Sending '%s', %d bytes", buf, bytes); | ||||
r = write(screen_list->comm.socket[SOCK_SERVER], buf, bytes+1); | r = write(screen_list->comm.socket[SOCK_SERVER], buf, bytes+1); | ||||
@@ -163,7 +164,7 @@ int mainloop_tick(char **pbuf, struct screen_list *screen_list) | |||||
{ | { | ||||
caca_event_t ev; | caca_event_t ev; | ||||
int ret = 0; | int ret = 0; | ||||
ssize_t n; | |||||
ptrdiff_t n; | |||||
if (!screen_list) | if (!screen_list) | ||||
return 0; | return 0; | ||||
if (!*pbuf) | if (!*pbuf) | ||||
@@ -188,7 +189,7 @@ int mainloop_tick(char **pbuf, struct screen_list *screen_list) | |||||
else if (!strncmp("UPDATE ", *pbuf, 7)) | else if (!strncmp("UPDATE ", *pbuf, 7)) | ||||
{ | { | ||||
int x, y; | int x, y; | ||||
ssize_t l2 = 0, lb = 0; | |||||
ptrdiff_t l2 = 0, lb = 0; | |||||
char *buf2; | char *buf2; | ||||
size_t l = 0; | size_t l = 0; | ||||
/* FIXME check the length before calling atoi */ | /* FIXME check the length before calling atoi */ | ||||
@@ -26,6 +26,7 @@ | |||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stddef.h> | |||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
@@ -235,7 +236,7 @@ static int list_process(struct process **process_list) | |||||
for (j = 0; j < pglob2.gl_pathc; j++) | for (j = 0; j < pglob2.gl_pathc; j++) | ||||
{ | { | ||||
char path[4096]; | char path[4096]; | ||||
ssize_t l = readlink(pglob2.gl_pathv[j], path, sizeof(path)); | |||||
ptrdiff_t l = readlink(pglob2.gl_pathv[j], path, sizeof(path)); | |||||
if (l <= 0) | if (l <= 0) | ||||
continue; | continue; | ||||
path[l] = '\0'; | path[l] = '\0'; | ||||
@@ -60,7 +60,7 @@ int client_step(void) | |||||
if (ret > 0) | if (ret > 0) | ||||
{ | { | ||||
char buf[BUFSIZ]; | char buf[BUFSIZ]; | ||||
ssize_t bytes = socket_read(insock, buf, BUFSIZ); | |||||
ptrdiff_t bytes = socket_read(insock, buf, BUFSIZ); | |||||
if (bytes <= 0) | if (bytes <= 0) | ||||
return 1; | return 1; | ||||
@@ -33,7 +33,7 @@ while (!insock) | |||||
int server_step(void) | int server_step(void) | ||||
{ | { | ||||
char buf[BUFSIZ]; | char buf[BUFSIZ]; | ||||
ssize_t bytes; | |||||
ptrdiff_t bytes; | |||||
int ret; | int ret; | ||||
if (outsock) | if (outsock) | ||||
@@ -278,7 +278,7 @@ fprintf(stderr, "pid %i sending %i bytes on %s: %s\n", getpid(), (int)strlen(str | |||||
return ret; | return ret; | ||||
} | } | ||||
ssize_t socket_read(nrx_socket_t *sock, void *buf, size_t count) | |||||
ptrdiff_t socket_read(nrx_socket_t *sock, void *buf, size_t count) | |||||
{ | { | ||||
int ret; | int ret; | ||||
ret = read(sock->fd, buf, count); | ret = read(sock->fd, buf, count); | ||||
@@ -19,6 +19,6 @@ typedef struct nrx_socket nrx_socket_t; | |||||
nrx_socket_t * socket_open(char const *path, int server); | nrx_socket_t * socket_open(char const *path, int server); | ||||
int socket_select(nrx_socket_t *sock, int usecs); | int socket_select(nrx_socket_t *sock, int usecs); | ||||
int socket_puts(nrx_socket_t *sock, char const *str); | int socket_puts(nrx_socket_t *sock, char const *str); | ||||
ssize_t socket_read(nrx_socket_t *sock, void *buf, size_t count); | |||||
ptrdiff_t socket_read(nrx_socket_t *sock, void *buf, size_t count); | |||||
void socket_close(nrx_socket_t *socket); | void socket_close(nrx_socket_t *socket); | ||||
@@ -331,10 +331,10 @@ int mytrace_exec(struct mytrace *t, char const *command) | |||||
char *env, *p; | char *env, *p; | ||||
long p2, envaddr, argvaddr, envptraddr; | long p2, envaddr, argvaddr, envptraddr; | ||||
char envpath[PATH_MAX + 1]; | char envpath[PATH_MAX + 1]; | ||||
ssize_t envsize = 16 * 1024; | |||||
ptrdiff_t envsize = 16 * 1024; | |||||
int ret, fd, l, l2; | int ret, fd, l, l2; | ||||
char *nullp = NULL; | char *nullp = NULL; | ||||
ssize_t r; | |||||
ptrdiff_t r; | |||||
ptrace(PTRACE_SETOPTIONS, t->pid, NULL, PTRACE_O_TRACEEXEC); | ptrace(PTRACE_SETOPTIONS, t->pid, NULL, PTRACE_O_TRACEEXEC); | ||||
@@ -20,6 +20,7 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stddef.h> | |||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <sys/wait.h> | #include <sys/wait.h> | ||||
@@ -294,7 +295,7 @@ int update_screens_contents(struct screen_list *screen_list) | |||||
for (;;) | for (;;) | ||||
{ | { | ||||
ssize_t nr; | |||||
ptrdiff_t nr; | |||||
screen_list->screen[i]->buf = | screen_list->screen[i]->buf = | ||||
realloc(screen_list->screen[i]->buf, | realloc(screen_list->screen[i]->buf, | ||||
@@ -21,6 +21,7 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stddef.h> | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
@@ -113,7 +114,7 @@ static int request_refresh(struct screen_list *screen_list) | |||||
if (screen_list->comm.socket[SOCK_CLIENT]) | if (screen_list->comm.socket[SOCK_CLIENT]) | ||||
{ | { | ||||
size_t bufsize, towrite; | size_t bufsize, towrite; | ||||
ssize_t written, ret; | |||||
ptrdiff_t written, ret; | |||||
socklen_t optlen = sizeof(bufsize); | socklen_t optlen = sizeof(bufsize); | ||||
size_t bytes; | size_t bytes; | ||||
void *buf; | void *buf; | ||||
@@ -149,7 +150,7 @@ static int request_refresh(struct screen_list *screen_list) | |||||
fcntl(screen_list->comm.socket[SOCK_CLIENT], F_SETFL, 0); | fcntl(screen_list->comm.socket[SOCK_CLIENT], F_SETFL, 0); | ||||
while (towrite > 0) | while (towrite > 0) | ||||
{ | { | ||||
ssize_t n; | |||||
ptrdiff_t n; | |||||
debug("Wrote %d, %d remaining", written, towrite); | debug("Wrote %d, %d remaining", written, towrite); | ||||
n = send_to_client((char *)buf + written, | n = send_to_client((char *)buf + written, | ||||
towrite > bufsize ? bufsize : towrite, | towrite > bufsize ? bufsize : towrite, | ||||
@@ -197,7 +198,7 @@ static int server_iteration(struct screen_list *screen_list) | |||||
int eof = 0, refresh; | int eof = 0, refresh; | ||||
int quit = 0; | int quit = 0; | ||||
ssize_t n; | |||||
ptrdiff_t n; | |||||
char buf[128]; | char buf[128]; | ||||
/* Read program output */ | /* Read program output */ | ||||
@@ -169,7 +169,7 @@ size_t Pty::ReadData(char *data, size_t maxlen) | |||||
{ | { | ||||
if (FD_ISSET((int)m_fd, &fdset)) | if (FD_ISSET((int)m_fd, &fdset)) | ||||
{ | { | ||||
ssize_t nr = read((int)m_fd, data, maxlen); | |||||
ptrdiff_t nr = read((int)m_fd, data, maxlen); | |||||
/* Data available but zero-length read: EOF */ | /* Data available but zero-length read: EOF */ | ||||
if (nr <= 0) | if (nr <= 0) | ||||