summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/java/nxt_jni_InputStream.c4
-rw-r--r--src/nxt_unit.c12
-rw-r--r--src/nxt_unit.h23
-rw-r--r--src/perl/nxt_perl_psgi.c2
4 files changed, 31 insertions, 10 deletions
diff --git a/src/java/nxt_jni_InputStream.c b/src/java/nxt_jni_InputStream.c
index 3b74b0c1..fabff685 100644
--- a/src/java/nxt_jni_InputStream.c
+++ b/src/java/nxt_jni_InputStream.c
@@ -104,7 +104,7 @@ nxt_java_InputStream_readLine(JNIEnv *env, jclass cls,
res = nxt_unit_request_read(req, data + off, res);
}
- nxt_unit_req_debug(req, "readLine '%.*s'", res, (char *) data + off);
+ nxt_unit_req_debug(req, "readLine '%.*s'", (int) res, (char *) data + off);
(*env)->ReleasePrimitiveArrayCritical(env, out, data, 0);
@@ -152,7 +152,7 @@ nxt_java_InputStream_read(JNIEnv *env, jclass cls, jlong req_info_ptr,
res = nxt_unit_request_read(req, data + off, len);
- nxt_unit_req_debug(req, "read '%.*s'", res, (char *) data + off);
+ nxt_unit_req_debug(req, "read '%.*s'", (int) res, (char *) data + off);
(*env)->ReleasePrimitiveArrayCritical(env, b, data, 0);
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index 7a4124fb..77e36771 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -971,8 +971,10 @@ nxt_unit_process_req_headers(nxt_unit_ctx_t *ctx, nxt_unit_recv_msg_t *recv_msg)
req_impl->websocket = 0;
nxt_unit_debug(ctx, "#%"PRIu32": %.*s %.*s (%d)", recv_msg->stream,
- (int) r->method_length, nxt_unit_sptr_get(&r->method),
- (int) r->target_length, nxt_unit_sptr_get(&r->target),
+ (int) r->method_length,
+ (char *) nxt_unit_sptr_get(&r->method),
+ (int) r->target_length,
+ (char *) nxt_unit_sptr_get(&r->target),
(int) r->content_length);
lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);
@@ -2084,7 +2086,7 @@ nxt_unit_mmap_buf_send(nxt_unit_ctx_t *ctx, uint32_t stream,
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
mmap_buf->process->pid,
- mmap_buf->process->outgoing.allocated_chunks);
+ (int) mmap_buf->process->outgoing.allocated_chunks);
} else {
if (nxt_slow_path(mmap_buf->plain_ptr == NULL
@@ -2972,7 +2974,7 @@ unlock:
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
process->pid,
- process->outgoing.allocated_chunks);
+ (int) process->outgoing.allocated_chunks);
pthread_mutex_unlock(&process->outgoing.mutex);
@@ -3691,7 +3693,7 @@ nxt_unit_mmap_release(nxt_unit_ctx_t *ctx,
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
process->pid,
- process->outgoing.allocated_chunks);
+ (int) process->outgoing.allocated_chunks);
}
if (hdr->dst_pid == lib->pid
diff --git a/src/nxt_unit.h b/src/nxt_unit.h
index 900f3ac2..596dd8b6 100644
--- a/src/nxt_unit.h
+++ b/src/nxt_unit.h
@@ -356,10 +356,29 @@ int nxt_unit_websocket_retain(nxt_unit_websocket_frame_t *ws);
void nxt_unit_websocket_done(nxt_unit_websocket_frame_t *ws);
-void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...);
+#if defined __has_attribute
+
+#if __has_attribute(format)
+
+#define NXT_ATTR_FORMAT __attribute__((format(printf, 3, 4)))
+
+#endif
+
+#endif
+
+
+#if !defined(NXT_ATTR_FORMAT)
+
+#define NXT_ATTR_FORMAT
+
+#endif
+
+
+void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...)
+ NXT_ATTR_FORMAT;
void nxt_unit_req_log(nxt_unit_request_info_t *req, int level,
- const char* fmt, ...);
+ const char* fmt, ...) NXT_ATTR_FORMAT;
#if (NXT_DEBUG)
diff --git a/src/perl/nxt_perl_psgi.c b/src/perl/nxt_perl_psgi.c
index 16159b5b..548e6daa 100644
--- a/src/perl/nxt_perl_psgi.c
+++ b/src/perl/nxt_perl_psgi.c
@@ -166,7 +166,7 @@ nxt_perl_psgi_io_error_write(PerlInterpreter *my_perl,
nxt_perl_psgi_input_t *input;
input = (nxt_perl_psgi_input_t *) arg->ctx;
- nxt_unit_req_error(input->req, "Perl: %s", vbuf);
+ nxt_unit_req_error(input->req, "Perl: %s", (const char*) vbuf);
return (long) length;
}