Skip to content

Commit

Permalink
Fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Aug 9, 2018
1 parent ff488c3 commit 3dae414
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/hammer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void perform_random_operation(struct us_socket *s) {
}
break;
case 3: {
us_socket_write(s, long_buffer, long_length, 0);
us_socket_write(s, (char *) long_buffer, long_length, 0);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int main() {

struct http_context *http_context_ext = (struct http_context *) us_socket_context_ext(http_context);
http_context_ext->response = (char *) malloc(128 + sizeof(body) - 1);
http_context_ext->length = snprintf(http_context_ext->response, 128 + sizeof(body) - 1, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s", sizeof(body) - 1, body);
http_context_ext->length = snprintf(http_context_ext->response, 128 + sizeof(body) - 1, "HTTP/1.1 200 OK\r\nContent-Length: %ld\r\n\r\n%s", sizeof(body) - 1, body);

/* Set up event handlers */
us_socket_context_on_open(http_context, on_http_socket_open);
Expand Down
8 changes: 4 additions & 4 deletions src/eventing/epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void us_poll_stop(struct us_poll *p, struct us_loop *loop) {
unsigned int us_internal_accept_poll_event(struct us_poll *p) {
int fd = us_poll_fd(p);
uint64_t buf;
read(fd, &buf, 8);
int read_length = read(fd, &buf, 8);
return buf;
}

Expand All @@ -126,7 +126,7 @@ void us_timer_close(struct us_timer *timer) {
close(us_poll_fd(&cb->p));

/* (regular) sockets are the only polls which are not freed immediately */
us_poll_free(timer, cb->loop);
us_poll_free((struct us_poll *) timer, cb->loop);
}

void us_timer_set(struct us_timer *t, void (*cb)(struct us_timer *t), int ms, int repeat_ms) {
Expand Down Expand Up @@ -169,7 +169,7 @@ void us_internal_async_close(struct us_internal_async *a) {
close(us_poll_fd(&cb->p));

/* (regular) sockets are the only polls which are not freed immediately */
us_poll_free(a, cb->loop);
us_poll_free((struct us_poll *) a, cb->loop);
}

void us_internal_async_set(struct us_internal_async *a, void (*cb)(struct us_internal_async *)) {
Expand All @@ -182,7 +182,7 @@ void us_internal_async_set(struct us_internal_async *a, void (*cb)(struct us_int

void us_internal_async_wakeup(struct us_internal_async *a) {
uint64_t one = 1;
write(us_poll_fd((struct us_poll *) a), &one, 8);
int written = write(us_poll_fd((struct us_poll *) a), &one, 8);
}

#endif
8 changes: 4 additions & 4 deletions src/eventing/libuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void us_poll_init(struct us_poll *p, LIBUS_SOCKET_DESCRIPTOR fd, int poll_type)
}

void us_poll_free(struct us_poll *p, struct us_loop *loop) {
if (uv_is_closing(&p->uv_p)) {
if (uv_is_closing((uv_handle_t *) &p->uv_p)) {
p->uv_p.data = p;
} else {
free(p);
Expand Down Expand Up @@ -105,12 +105,12 @@ struct us_loop *us_create_loop(int default_hint, void (*wakeup_cb)(struct us_loo
loop->uv_pre = malloc(sizeof(uv_prepare_t));
uv_prepare_init(loop->uv_loop, loop->uv_pre);
uv_prepare_start(loop->uv_pre, prepare_cb);
uv_unref(loop->uv_pre);
uv_unref((uv_handle_t *) loop->uv_pre);
loop->uv_pre->data = loop;

loop->uv_check = malloc(sizeof(uv_check_t));
uv_check_init(loop->uv_loop, loop->uv_check);
uv_unref(loop->uv_check);
uv_unref((uv_handle_t *) loop->uv_check);
uv_check_start(loop->uv_check, check_cb);
loop->uv_check->data = loop;

Expand Down Expand Up @@ -221,7 +221,7 @@ void us_internal_async_set(struct us_internal_async *a, void (*cb)(struct us_int

uv_async_t *uv_async = (uv_async_t *) (internal_cb + 1);
uv_async_init(internal_cb->loop->uv_loop, uv_async, async_cb);
uv_unref(uv_async);
uv_unref((uv_handle_t *) uv_async);
uv_async->data = internal_cb;
}

Expand Down
1 change: 0 additions & 1 deletion src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ void ssl_on_data(struct us_ssl_socket *s, void *data, int length) {

// check this then?
if (SSL_get_shutdown(s->ssl) & SSL_RECEIVED_SHUTDOWN) {
received_shutdown:
printf("SSL_RECEIVED_SHUTDOWN\n");

//us_
Expand Down

0 comments on commit 3dae414

Please sign in to comment.