Browse Source

Fix some examples/ compile warnings

pull/1697/head
Sami Vaarala 7 years ago
parent
commit
8666277387
  1. 2
      examples/codepage-conv/duk_codepage_conv.c
  2. 6
      examples/eventloop/c_eventloop.c
  3. 2
      examples/eventloop/poll.c
  4. 6
      examples/eventloop/socket.c

2
examples/codepage-conv/duk_codepage_conv.c

@ -23,7 +23,7 @@ void duk_decode_string_codepage(duk_context *ctx, const char *str, size_t len, u
tmplen = 3 * len; /* max expansion is 1 input byte -> 3 output bytes */
if (tmplen / 3 != len) {
/* Temporary buffer length wraps. */
duk_error(ctx, DUK_ERR_RANGE_ERROR, "input string too long");
(void) duk_error(ctx, DUK_ERR_RANGE_ERROR, "input string too long");
return;
}

6
examples/eventloop/c_eventloop.c

@ -201,7 +201,7 @@ static void expire_timers(duk_context *ctx) {
fflush(stderr);
#endif
if (timer_count >= MAX_TIMERS) {
duk_error(ctx, DUK_ERR_RANGE_ERROR, "out of timer slots");
(void) duk_error(ctx, DUK_ERR_RANGE_ERROR, "out of timer slots");
}
memcpy((void *) (timer_list + timer_count), (void *) t, sizeof(ev_timer));
timer_count++;
@ -419,7 +419,7 @@ static int create_timer(duk_context *ctx) {
oneshot = duk_require_boolean(ctx, 2);
if (timer_count >= MAX_TIMERS) {
duk_error(ctx, DUK_ERR_RANGE_ERROR, "out of timer slots");
(void) duk_error(ctx, DUK_ERR_RANGE_ERROR, "out of timer slots");
}
idx = timer_count++;
timer_id = timer_next_id++;
@ -574,7 +574,7 @@ static int listen_fd(duk_context *ctx) {
#endif
if (poll_count >= MAX_FDS) {
duk_error(ctx, DUK_ERR_ERROR, "out of fd slots");
(void) duk_error(ctx, DUK_ERR_ERROR, "out of fd slots");
}
pfd = poll_list + poll_count;

2
examples/eventloop/poll.c

@ -52,7 +52,7 @@ static int poll_poll(duk_context *ctx) {
/*rc = ppoll(fds, n, &ts, NULL);*/
rc = poll(fds, n, timeout);
if (rc < 0) {
duk_error(ctx, DUK_ERR_ERROR, "%s (errno=%d)", strerror(errno), errno);
(void) duk_error(ctx, DUK_ERR_ERROR, "%s (errno=%d)", strerror(errno), errno);
}
duk_push_array(ctx);

6
examples/eventloop/socket.c

@ -17,7 +17,7 @@
#include "duktape.h"
#define ERROR_FROM_ERRNO(ctx) do { \
duk_error(ctx, DUK_ERR_ERROR, "%s (errno=%d)", strerror(errno), errno); \
(void) duk_error(ctx, DUK_ERR_ERROR, "%s (errno=%d)", strerror(errno), errno); \
} while (0)
static void set_nonblocking(duk_context *ctx, int fd) {
@ -96,7 +96,7 @@ static int socket_create_server_socket(duk_context *ctx) {
break;
}
if (!addr_inet) {
duk_error(ctx, DUK_ERR_ERROR, "cannot resolve %s", addr);
(void) duk_error(ctx, DUK_ERR_ERROR, "cannot resolve %s", addr);
}
memset(&sockaddr, 0, sizeof(sockaddr));
@ -204,7 +204,7 @@ static int socket_connect(duk_context *ctx) {
break;
}
if (!addr_inet) {
duk_error(ctx, DUK_ERR_ERROR, "cannot resolve %s", addr);
(void) duk_error(ctx, DUK_ERR_ERROR, "cannot resolve %s", addr);
}
memset(&sockaddr, 0, sizeof(sockaddr));

Loading…
Cancel
Save