diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2018-01-24 15:16:32 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2018-01-24 15:16:32 +0300 |
commit | 67c64a99fb78f48c3deacc7d89e73de72522806b (patch) | |
tree | 384b433c94fc63e27d21d6b05153d162655e79bc | |
parent | 477e8177b70acb694759e62d830b8a311a736324 (diff) | |
download | unit-67c64a99fb78f48c3deacc7d89e73de72522806b.tar.gz unit-67c64a99fb78f48c3deacc7d89e73de72522806b.tar.bz2 |
Using size_t for the field width type of the "%*s" specifier.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_application.c | 8 | ||||
-rw-r--r-- | src/nxt_conn_accept.c | 3 | ||||
-rw-r--r-- | src/nxt_conn_connect.c | 3 | ||||
-rw-r--r-- | src/nxt_http_request.c | 3 | ||||
-rw-r--r-- | src/nxt_listen_socket.c | 2 | ||||
-rw-r--r-- | src/nxt_main_process.c | 14 | ||||
-rw-r--r-- | src/nxt_router.c | 6 | ||||
-rw-r--r-- | src/nxt_sockaddr.c | 4 | ||||
-rw-r--r-- | src/nxt_socket.c | 12 | ||||
-rw-r--r-- | src/nxt_sprintf.c | 2 | ||||
-rw-r--r-- | src/nxt_stream_module.c | 3 | ||||
-rw-r--r-- | src/nxt_upstream_round_robin.c | 2 | ||||
-rw-r--r-- | src/test/nxt_http_parse_test.c | 5 |
13 files changed, 39 insertions, 28 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c index 69f68616..462767f3 100644 --- a/src/nxt_application.c +++ b/src/nxt_application.c @@ -476,7 +476,8 @@ nxt_app_msg_write(nxt_task_t *task, nxt_app_wmsg_t *msg, u_char *c, size_t size) nxt_memcpy(dst, c, size); dst[size] = 0; - nxt_debug(task, "nxt_app_msg_write: %uz %*s", size, (int) size, c); + nxt_debug(task, "nxt_app_msg_write: %uz %*s", size, size, c); + } else { dst_length = 1; @@ -598,8 +599,9 @@ nxt_app_msg_read_str(nxt_task_t *task, nxt_app_rmsg_t *msg, nxt_str_t *str) buf->mem.pos += length; - nxt_debug(task, "nxt_read_str: %d %*s", (int) length - 1, - (int) length - 1, str->start); + nxt_debug(task, "nxt_read_str: %uz %*s", length - 1, + length - 1, str->start); + } else { str->start = NULL; str->length = 0; diff --git a/src/nxt_conn_accept.c b/src/nxt_conn_accept.c index f2a50301..80b599b4 100644 --- a/src/nxt_conn_accept.c +++ b/src/nxt_conn_accept.c @@ -189,7 +189,8 @@ nxt_conn_accept(nxt_task_t *task, nxt_listen_event_t *lev, nxt_conn_t *c) nxt_sockaddr_text(c->remote); nxt_debug(task, "client: %*s", - c->remote->address_length, nxt_sockaddr_address(c->remote)); + (size_t) c->remote->address_length, + nxt_sockaddr_address(c->remote)); nxt_queue_insert_head(&task->thread->engine->idle_connections, &c->link); diff --git a/src/nxt_conn_connect.c b/src/nxt_conn_connect.c index 94d25c30..a5736226 100644 --- a/src/nxt_conn_connect.c +++ b/src/nxt_conn_connect.c @@ -155,7 +155,8 @@ nxt_conn_connect_test(nxt_task_t *task, void *obj, void *data) c->socket.error = err; nxt_log(task, nxt_socket_error_level(err), "connect(%d, %*s) failed %E", - c->socket.fd, c->remote->length, nxt_sockaddr_start(c->remote)); + c->socket.fd, (size_t) c->remote->length, + nxt_sockaddr_start(c->remote)); nxt_conn_connect_error(task, c, data); } diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 270ebba7..9c7d4451 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -375,7 +375,8 @@ nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data) r->logged = 1; // STUB nxt_debug(task, "http request log: \"%*s \"%V %V %V\" %d\"", - r->remote->address_length, nxt_sockaddr_address(r->remote), + (size_t) r->remote->address_length, + nxt_sockaddr_address(r->remote), r->method, &r->target, &r->version, r->status); } diff --git a/src/nxt_listen_socket.c b/src/nxt_listen_socket.c index 7521fec1..6e8ea586 100644 --- a/src/nxt_listen_socket.c +++ b/src/nxt_listen_socket.c @@ -305,5 +305,5 @@ nxt_listen_socket_log_handler(void *ctx, u_char *pos, u_char *end) sa = ctx; return nxt_sprintf(pos, end, " while creating listening socket on %*s", - sa->length, sa->start); + (size_t) sa->length, sa->start); } diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index aa935a96..af72c111 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -870,13 +870,13 @@ nxt_main_port_socket_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) msg->port_msg.reply_port); nxt_debug(task, "listening socket \"%*s\"", - sa->length, nxt_sockaddr_start(sa)); + (size_t) sa->length, nxt_sockaddr_start(sa)); ret = nxt_main_listening_socket(sa, &ls); if (ret == NXT_OK) { nxt_debug(task, "socket(\"%*s\"): %d", - sa->length, nxt_sockaddr_start(sa), ls.socket); + (size_t) sa->length, nxt_sockaddr_start(sa), ls.socket); type = NXT_PORT_MSG_RPC_READY_LAST | NXT_PORT_MSG_CLOSE_FD; @@ -927,7 +927,7 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls) ls->end = nxt_sprintf(ls->start, ls->end, "socket(\\\"%*s\\\") failed %E", - sa->length, nxt_sockaddr_start(sa), err); + (size_t) sa->length, nxt_sockaddr_start(sa), err); return NXT_ERROR; } @@ -935,7 +935,8 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls) if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &enable, length) != 0) { ls->end = nxt_sprintf(ls->start, ls->end, "setsockopt(\\\"%*s\\\", SO_REUSEADDR) failed %E", - sa->length, nxt_sockaddr_start(sa), nxt_errno); + (size_t) sa->length, nxt_sockaddr_start(sa), + nxt_errno); goto fail; } @@ -946,7 +947,8 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls) if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &enable, length) != 0) { ls->end = nxt_sprintf(ls->start, ls->end, "setsockopt(\\\"%*s\\\", IPV6_V6ONLY) failed %E", - sa->length, nxt_sockaddr_start(sa), nxt_errno); + (size_t) sa->length, nxt_sockaddr_start(sa), + nxt_errno); goto fail; } } @@ -992,7 +994,7 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls) } ls->end = nxt_sprintf(ls->start, ls->end, "bind(\\\"%*s\\\") failed %E", - sa->length, nxt_sockaddr_start(sa), err); + (size_t) sa->length, nxt_sockaddr_start(sa), err); goto fail; } diff --git a/src/nxt_router.c b/src/nxt_router.c index a09dd498..a2effb57 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -713,7 +713,7 @@ nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) nxt_debug(task, "nxt_router_conf_data_handler(%d): %*s", nxt_buf_used_size(msg->buf), - nxt_buf_used_size(msg->buf), msg->buf->mem.pos); + (size_t) nxt_buf_used_size(msg->buf), msg->buf->mem.pos); b = nxt_buf_chk_make_plain(tmcf->conf->mem_pool, msg->buf, msg->size); @@ -1384,7 +1384,7 @@ nxt_router_socket_conf(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, sa->type = SOCK_STREAM; nxt_debug(task, "router listener: \"%*s\"", - sa->length, nxt_sockaddr_start(sa)); + (size_t) sa->length, nxt_sockaddr_start(sa)); skcf = nxt_mp_zget(tmcf->conf->mem_pool, sizeof(nxt_socket_conf_t)); if (nxt_slow_path(skcf == NULL)) { @@ -1615,7 +1615,7 @@ nxt_router_listen_socket_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, out->mem.free = nxt_sprintf(out->mem.free, out->mem.end, "listen socket error: " "{listener: \"%*s\", code:\"%V\", message: \"%*s\"}", - sa->length, nxt_sockaddr_start(sa), + (size_t) sa->length, nxt_sockaddr_start(sa), &socket_errors[error], in->mem.free - p, p); nxt_debug(task, "%*s", out->mem.free - out->mem.pos, out->mem.pos); diff --git a/src/nxt_sockaddr.c b/src/nxt_sockaddr.c index af2b8674..cd8a2cd2 100644 --- a/src/nxt_sockaddr.c +++ b/src/nxt_sockaddr.c @@ -287,7 +287,7 @@ nxt_sockaddr_text(nxt_sockaddr_t *sa) #if (NXT_LINUX) if (p[0] == '\0') { - int length; + size_t length; /* Linux abstract socket address has no trailing zero. */ length = sa->socklen - offsetof(struct sockaddr_un, sun_path); @@ -478,7 +478,7 @@ nxt_sockaddr_ntop(nxt_sockaddr_t *sa, u_char *buf, u_char *end, nxt_bool_t port) p = (u_char *) sa->u.sockaddr_un.sun_path; if (p[0] == '\0') { - int length; + size_t length; /* Linux abstract socket address has no trailing zero. */ diff --git a/src/nxt_socket.c b/src/nxt_socket.c index b9bbac46..529d7f7d 100644 --- a/src/nxt_socket.c +++ b/src/nxt_socket.c @@ -190,7 +190,8 @@ nxt_socket_bind(nxt_task_t *task, nxt_socket_t s, nxt_sockaddr_t *sa, { nxt_err_t err; - nxt_debug(task, "bind(%d, %*s)", s, sa->length, nxt_sockaddr_start(sa)); + nxt_debug(task, "bind(%d, %*s)", s, (size_t) sa->length, + nxt_sockaddr_start(sa)); if (nxt_fast_path(bind(s, &sa->u.sockaddr, sa->socklen) == 0)) { return NXT_OK; @@ -203,7 +204,7 @@ nxt_socket_bind(nxt_task_t *task, nxt_socket_t s, nxt_sockaddr_t *sa, } nxt_log(task, NXT_LOG_CRIT, "bind(%d, %*s) failed %E", - s, sa->length, nxt_sockaddr_start(sa), err); + s, (size_t) sa->length, nxt_sockaddr_start(sa), err); return NXT_ERROR; } @@ -216,7 +217,8 @@ nxt_socket_connect(nxt_task_t *task, nxt_socket_t s, nxt_sockaddr_t *sa) nxt_int_t ret; nxt_uint_t level; - nxt_debug(task, "connect(%d, %*s)", s, sa->length, nxt_sockaddr_start(sa)); + nxt_debug(task, "connect(%d, %*s)", + s, (size_t) sa->length, nxt_sockaddr_start(sa)); if (connect(s, &sa->u.sockaddr, sa->socklen) == 0) { return NXT_OK; @@ -228,7 +230,7 @@ nxt_socket_connect(nxt_task_t *task, nxt_socket_t s, nxt_sockaddr_t *sa) case NXT_EINPROGRESS: nxt_debug(task, "connect(%d, %*s) in progress", - s, sa->length, nxt_sockaddr_start(sa)); + s, (size_t) sa->length, nxt_sockaddr_start(sa)); return NXT_AGAIN; case NXT_ECONNREFUSED: @@ -258,7 +260,7 @@ nxt_socket_connect(nxt_task_t *task, nxt_socket_t s, nxt_sockaddr_t *sa) } nxt_log(task, level, "connect(%d, %*s) failed %E", - s, sa->length, nxt_sockaddr_start(sa), err); + s, (size_t) sa->length, nxt_sockaddr_start(sa), err); return ret; } diff --git a/src/nxt_sprintf.c b/src/nxt_sprintf.c index c07b44da..5f0314f2 100644 --- a/src/nxt_sprintf.c +++ b/src/nxt_sprintf.c @@ -163,7 +163,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args) continue; case '*': - length = va_arg(args, u_int); + length = va_arg(args, size_t); fmt++; diff --git a/src/nxt_stream_module.c b/src/nxt_stream_module.c index 461928c9..25aaec57 100644 --- a/src/nxt_stream_module.c +++ b/src/nxt_stream_module.c @@ -65,7 +65,8 @@ nxt_stream_connection_peer(nxt_task_t *task, nxt_upstream_peer_t *up) up->sockaddr->type = SOCK_STREAM; nxt_log_debug(c->socket.log, "stream connection peer %*s", - up->sockaddr->length, nxt_sockaddr_start(up->sockaddr)); + (size_t) up->sockaddr->length, + nxt_sockaddr_start(up->sockaddr)); p = nxt_conn_proxy_create(c); if (nxt_slow_path(p == NULL)) { diff --git a/src/nxt_upstream_round_robin.c b/src/nxt_upstream_round_robin.c index 089f22b1..09a3bce3 100644 --- a/src/nxt_upstream_round_robin.c +++ b/src/nxt_upstream_round_robin.c @@ -99,7 +99,7 @@ nxt_upstream_round_robin_create(nxt_task_t *task, void *obj, void *data) nxt_sockaddr_text(sa); nxt_debug(task, "upstream peer: %*s", - sa->length, nxt_sockaddr_start(sa)); + (size_t) sa->length, nxt_sockaddr_start(sa)); /* TODO: memcpy to shared memory pool. */ peer[i].sockaddr = sa; diff --git a/src/test/nxt_http_parse_test.c b/src/test/nxt_http_parse_test.c index 3da10766..3b924614 100644 --- a/src/test/nxt_http_parse_test.c +++ b/src/test/nxt_http_parse_test.c @@ -712,8 +712,9 @@ nxt_http_parse_test_request_line(nxt_http_request_parse_t *rp, if (nxt_memcmp(rp->version.str, test->version, 8) != 0) { nxt_log_alert(log, "http parse test case failed:\n" " - request:\n\"%V\"\n" - " - version: \"%*s\" (expected: \"%*s\")", - request, 8, rp->version.str, 8, test->version); + " - version: \"%*s\" (expected: \"%*s\")", request, + (size_t) 8, rp->version.str, + (size_t) 8, test->version); return NXT_ERROR; } |