Clear some warns on w32
This commit is contained in:
parent
c4d2e91508
commit
7d55e7737d
|
@ -149,7 +149,8 @@ R_API int r_socket_rap_server_continue (RSocketRapServer *rap_s) {
|
||||||
r_socket_flush (rap_s->fd);
|
r_socket_flush (rap_s->fd);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
eprintf ("unknown command 0x%02hhx\n", rap_s->buf[0]);
|
eprintf ("unknown command 0x%02x\n", \
|
||||||
|
(unsigned int)(unsigned char)rap_s->buf[0]);
|
||||||
r_socket_close (rap_s->fd);
|
r_socket_close (rap_s->fd);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -533,7 +533,7 @@ R_API int r_run_start(RRunProfile *p) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// TODO: use posix_spawn
|
// TODO: use posix_spawn
|
||||||
exit (execv (p->_program, p->_args));
|
exit (execv (p->_program, (const char **)p->_args));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ R_API int r_socket_is_connected (RSocket *s) {
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
char buf[2];
|
char buf[2];
|
||||||
r_socket_block_time (s, 0, 0);
|
r_socket_block_time (s, 0, 0);
|
||||||
int ret = recv (s->fd, &buf, 1, MSG_PEEK);
|
ssize_t ret = recv (s->fd, (char*)&buf, 1, MSG_PEEK);
|
||||||
r_socket_block_time (s, 1, 0);
|
r_socket_block_time (s, 1, 0);
|
||||||
return ret? R_TRUE: R_FALSE;
|
return ret? R_TRUE: R_FALSE;
|
||||||
#else
|
#else
|
||||||
|
@ -284,9 +284,11 @@ R_API int r_socket_port_by_name(const char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
R_API int r_socket_listen (RSocket *s, const char *port, const char *certfile) {
|
R_API int r_socket_listen (RSocket *s, const char *port, const char *certfile) {
|
||||||
|
#if __UNIX__
|
||||||
int optval = 1;
|
int optval = 1;
|
||||||
int ret;
|
int ret;
|
||||||
struct linger linger = { 0 };
|
struct linger linger = { 0 };
|
||||||
|
#endif
|
||||||
if (r_sandbox_enable (0))
|
if (r_sandbox_enable (0))
|
||||||
return R_FALSE;
|
return R_FALSE;
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
|
@ -393,11 +395,12 @@ R_API RSocket *r_socket_accept(RSocket *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
R_API int r_socket_block_time (RSocket *s, int block, int sec) {
|
R_API int r_socket_block_time (RSocket *s, int block, int sec) {
|
||||||
int ret;
|
#if __UNIX__
|
||||||
|
int ret, flags;
|
||||||
|
#endif
|
||||||
if (!s) return R_FALSE;
|
if (!s) return R_FALSE;
|
||||||
#if __UNIX__
|
#if __UNIX__
|
||||||
{
|
flags = fcntl (s->fd, F_GETFL, 0);
|
||||||
int flags = fcntl (s->fd, F_GETFL, 0);
|
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
return R_FALSE;
|
return R_FALSE;
|
||||||
ret = fcntl (s->fd, F_SETFL, block?
|
ret = fcntl (s->fd, F_SETFL, block?
|
||||||
|
@ -405,7 +408,6 @@ R_API int r_socket_block_time (RSocket *s, int block, int sec) {
|
||||||
(flags | O_NONBLOCK));
|
(flags | O_NONBLOCK));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return R_FALSE;
|
return R_FALSE;
|
||||||
}
|
|
||||||
#elif __WINDOWS__
|
#elif __WINDOWS__
|
||||||
// HACK: nonblocking io on w32 behaves strange
|
// HACK: nonblocking io on w32 behaves strange
|
||||||
return R_TRUE;
|
return R_TRUE;
|
||||||
|
@ -464,7 +466,7 @@ R_API int r_socket_ready(RSocket *s, int secs, int usecs) {
|
||||||
R_API char *r_socket_to_string(RSocket *s) {
|
R_API char *r_socket_to_string(RSocket *s) {
|
||||||
#if __WINDOWS__
|
#if __WINDOWS__
|
||||||
char *str = malloc (32);
|
char *str = malloc (32);
|
||||||
snprintf (str, sizeof (str), "fd%d", s->fd);
|
snprintf (str, 31, "fd%d", s->fd);
|
||||||
return str;
|
return str;
|
||||||
#elif __UNIX__
|
#elif __UNIX__
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
|
Loading…
Reference in New Issue