summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-16 00:43:03 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-16 00:43:03 -0800
commit39dbff5615631522d3ef98b83141957038502c0d (patch)
tree89becbf88ebb79df9c9202450acd476bd790bde0 /src
parentf71209a0b429cddcd44f1f2473c49e986c9b4be7 (diff)
downloadnng-39dbff5615631522d3ef98b83141957038502c0d.tar.gz
nng-39dbff5615631522d3ef98b83141957038502c0d.tar.bz2
nng-39dbff5615631522d3ef98b83141957038502c0d.zip
Various complaints found in AppVeyor build.
Diffstat (limited to 'src')
-rw-r--r--src/core/endpt.c1
-rw-r--r--src/core/idhash.c4
-rw-r--r--src/core/message.c6
-rw-r--r--src/core/options.c2
-rw-r--r--src/core/socket.c4
-rw-r--r--src/platform/windows/win_clock.c2
-rw-r--r--src/platform/windows/win_ipc.c13
-rw-r--r--src/platform/windows/win_net.c10
-rw-r--r--src/platform/windows/win_thread.c2
-rw-r--r--src/protocol/bus/bus.c1
-rw-r--r--src/protocol/pair/pair.c1
-rw-r--r--src/protocol/pipeline/pull.c2
-rw-r--r--src/protocol/pipeline/push.c1
-rw-r--r--src/protocol/pubsub/pub.c1
-rw-r--r--src/protocol/pubsub/sub.c2
-rw-r--r--src/protocol/reqrep/rep.c2
-rw-r--r--src/protocol/survey/respond.c2
-rw-r--r--src/transport/inproc/inproc.c1
-rw-r--r--src/transport/ipc/ipc.c1
-rw-r--r--src/transport/tcp/tcp.c1
20 files changed, 19 insertions, 40 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index c4673376..09ef0884 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -139,7 +139,6 @@ static void
nni_dialer(void *arg)
{
nni_ep *ep = arg;
- nni_pipe *pipe;
int rv;
nni_time cooldown;
nni_mtx *mx = &ep->ep_sock->s_mx;
diff --git a/src/core/idhash.c b/src/core/idhash.c
index 58b68bbf..d816ddf4 100644
--- a/src/core/idhash.c
+++ b/src/core/idhash.c
@@ -91,7 +91,7 @@ nni_hash_resize(nni_idhash *h)
uint32_t oldsize;
nni_idhash_entry *newents;
nni_idhash_entry *oldents;
- int i;
+ uint32_t i;
if ((h->ih_load < h->ih_maxload) && (h->ih_load >= h->ih_minload)) {
// No resize needed.
@@ -231,7 +231,7 @@ nni_idhash_count(nni_idhash *h, uint32_t *countp)
int
nni_idhash_walk(nni_idhash *h, nni_idhash_walkfn fn, void *arg)
{
- int i, rv;
+ uint32_t i, rv;
for (i = 0; i < h->ih_cap; i++) {
nni_idhash_entry *ent = &h->ih_entries[i];
diff --git a/src/core/message.c b/src/core/message.c
index 4c666955..778e7dfc 100644
--- a/src/core/message.c
+++ b/src/core/message.c
@@ -41,7 +41,7 @@ typedef struct {
static void
nni_chunk_dump(const nni_chunk *chunk, char *prefix)
{
- int i, j;
+ size_t i, j;
uint8_t x;
char buf[128];
@@ -59,7 +59,7 @@ nni_chunk_dump(const nni_chunk *chunk, char *prefix)
nni_println(buf);
j = 0;
}
- snprintf(buf, sizeof (buf), " %4x: ", i);
+ snprintf(buf, sizeof (buf), " %4x: ", (unsigned) i);
j += strlen(buf);
}
buf[j++] = ' ';
@@ -413,7 +413,7 @@ nni_msg_getopt(nni_msg *m, int opt, void *val, size_t *szp)
NNI_LIST_FOREACH (&m->m_options, mo) {
if (mo->mo_num == opt) {
- int sz = *szp;
+ size_t sz = *szp;
if (sz > mo->mo_sz) {
sz = mo->mo_sz;
memcpy(val, mo->mo_val, sz);
diff --git a/src/core/options.c b/src/core/options.c
index 24d7a9eb..32b65ebf 100644
--- a/src/core/options.c
+++ b/src/core/options.c
@@ -103,7 +103,7 @@ nni_getopt_buf(nni_msgq *mq, void *val, size_t *sizep)
{
int len = nni_msgq_cap(mq);
- int sz = *sizep;
+ size_t sz = *sizep;
if (sz > sizeof (len)) {
sz = sizeof (len);
diff --git a/src/core/socket.c b/src/core/socket.c
index c6b0408e..ae7cbc13 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -567,8 +567,6 @@ nni_sock_senderr(nni_sock *sock, int err)
int
nni_sock_setopt(nni_sock *sock, int opt, const void *val, size_t size)
{
- size_t rsz;
- void *ptr;
int rv = ENOTSUP;
nni_mtx_lock(&sock->s_mx);
@@ -612,8 +610,6 @@ nni_sock_setopt(nni_sock *sock, int opt, const void *val, size_t size)
int
nni_sock_getopt(nni_sock *sock, int opt, void *val, size_t *sizep)
{
- size_t rsz;
- void *ptr;
int rv = ENOTSUP;
nni_mtx_lock(&sock->s_mx);
diff --git a/src/platform/windows/win_clock.c b/src/platform/windows/win_clock.c
index 9a2546ae..d0d2e7ca 100644
--- a/src/platform/windows/win_clock.c
+++ b/src/platform/windows/win_clock.c
@@ -22,7 +22,7 @@ nni_plat_clock(void)
void
nni_plat_usleep(nni_duration usec)
{
- Sleep((usec + 999) / 1000);
+ Sleep((DWORD)((usec + 999) / 1000));
}
diff --git a/src/platform/windows/win_ipc.c b/src/platform/windows/win_ipc.c
index 42590ee9..86a4be03 100644
--- a/src/platform/windows/win_ipc.c
+++ b/src/platform/windows/win_ipc.c
@@ -11,6 +11,8 @@
#ifdef PLATFORM_WINDOWS
+#include <stdio.h>
+
// Windows has infinite numbers of error codes it seems. We only bother
// with the ones that are relevant to us (we think).
static struct {
@@ -73,7 +75,7 @@ nni_plat_ipc_send(nni_plat_ipcsock *s, nni_iov *iovs, int cnt)
OVERLAPPED *olp = &s->send_olpd;
NNI_ASSERT(cnt <= 4);
- for (i = 0, resid = 0; i < cnt; resid += iov[i].iov_len, i++) {
+ for (i = 0, resid = 0; i < cnt; resid += (DWORD) iov[i].iov_len, i++) {
iov[i].iov_len = iovs[i].iov_len;
iov[i].iov_buf = iovs[i].iov_buf;
}
@@ -84,7 +86,8 @@ nni_plat_ipc_send(nni_plat_ipcsock *s, nni_iov *iovs, int cnt)
nsent = 0;
// We limit ourselves to writing 16MB at a time. Named Pipes
// on Windows have limits of between 31 and 64MB.
- len = iov[i].iov_len > 0x1000000 ? 0x1000000 : iov[i].iov_len;
+ len = iov[i].iov_len > 0x1000000 ? 0x1000000 :
+ (DWORD) iov[i].iov_len;
buf = iov[i].iov_buf;
if (!WriteFile(s->p, buf, len, NULL, olp)) {
@@ -123,7 +126,7 @@ nni_plat_ipc_recv(nni_plat_ipcsock *s, nni_iov *iovs, int cnt)
OVERLAPPED *olp = &s->recv_olpd;
NNI_ASSERT(cnt <= 4);
- for (i = 0, resid = 0; i < cnt; resid += iov[i].iov_len, i++) {
+ for (i = 0, resid = 0; i < cnt; resid += (DWORD) iov[i].iov_len, i++) {
iov[i].iov_len = iovs[i].iov_len;
iov[i].iov_buf = iovs[i].iov_buf;
}
@@ -134,7 +137,8 @@ nni_plat_ipc_recv(nni_plat_ipcsock *s, nni_iov *iovs, int cnt)
nrecv = 0;
// We limit ourselves to writing 16MB at a time. Named Pipes
// on Windows have limits of between 31 and 64MB.
- len = iov[i].iov_len > 0x1000000 ? 0x1000000 : iov[i].iov_len;
+ len = iov[i].iov_len > 0x1000000 ? 0x1000000 :
+ (DWORD) iov[i].iov_len;
buf = iov[i].iov_buf;
if (!ReadFile(s->p, buf, len, NULL, olp)) {
@@ -262,7 +266,6 @@ nni_plat_ipc_accept(nni_plat_ipcsock *s, nni_plat_ipcsock *server)
{
int rv;
OVERLAPPED *olp = &s->conn_olpd;
- HANDLE newp;
DWORD nbytes;
s->server = 1;
diff --git a/src/platform/windows/win_net.c b/src/platform/windows/win_net.c
index 48be1781..060324eb 100644
--- a/src/platform/windows/win_net.c
+++ b/src/platform/windows/win_net.c
@@ -190,7 +190,6 @@ nni_plat_tcp_send(nni_plat_tcpsock *s, nni_iov *iovs, int cnt)
WSABUF iov[4]; // We never have more than 3 at present
int i;
int rv;
- DWORD offset;
DWORD nsent;
DWORD resid;
DWORD flags;
@@ -202,7 +201,7 @@ nni_plat_tcp_send(nni_plat_tcpsock *s, nni_iov *iovs, int cnt)
for (i = 0, resid = 0; i < cnt; resid += iov[i].len, i++) {
iov[i].buf = iovs[i].iov_buf;
- iov[i].len = iovs[i].iov_len;
+ iov[i].len = (DWORD)iovs[i].iov_len;
}
i = 0;
@@ -247,7 +246,6 @@ nni_plat_tcp_recv(nni_plat_tcpsock *s, nni_iov *iovs, int cnt)
WSABUF iov[4]; // We never have more than 3 at present
int i;
int rv;
- DWORD offset;
DWORD resid;
DWORD nrecv;
DWORD flags;
@@ -259,7 +257,7 @@ nni_plat_tcp_recv(nni_plat_tcpsock *s, nni_iov *iovs, int cnt)
for (i = 0, resid = 0; i < cnt; resid += iov[i].len, i++) {
iov[i].buf = iovs[i].iov_buf;
- iov[i].len = iovs[i].iov_len;
+ iov[i].len = (DWORD)iovs[i].iov_len;
}
i = 0;
@@ -352,8 +350,7 @@ nni_plat_tcp_open(nni_plat_tcpsock *s)
GUID guid1 = WSAID_CONNECTEX;
GUID guid2 = WSAID_ACCEPTEX;
- s->s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0,
- WSA_FLAG_NO_HANDLE_INHERIT|WSA_FLAG_OVERLAPPED);
+ s->s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s->s == INVALID_SOCKET) {
rv = WSAGetLastError();
return (nni_winsock_error(rv));
@@ -478,7 +475,6 @@ nni_plat_tcp_connect(nni_plat_tcpsock *s, const nni_sockaddr *addr,
SOCKADDR_STORAGE ss;
SOCKADDR_STORAGE bss;
WSAOVERLAPPED *olp = &s->conn_olpd;
- BOOL ok;
DWORD nbytes;
DWORD flags;
int rv;
diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c
index 2dcb62fe..ef4859d6 100644
--- a/src/platform/windows/win_thread.c
+++ b/src/platform/windows/win_thread.c
@@ -95,7 +95,7 @@ nni_plat_cv_until(nni_plat_cv *cv, nni_time until)
msec = 0;
} else {
// times are in usec, but win32 wants millis
- msec = ((until - now) + 999)/1000;
+ msec = (DWORD)(((until - now) + 999)/1000);
}
ok = SleepConditionVariableCS(&cv->cv, cv->cs, msec);
diff --git a/src/protocol/bus/bus.c b/src/protocol/bus/bus.c
index 3c9d0674..0d57f1db 100644
--- a/src/protocol/bus/bus.c
+++ b/src/protocol/bus/bus.c
@@ -41,7 +41,6 @@ static int
nni_bus_sock_init(void **sp, nni_sock *nsock)
{
nni_bus_sock *psock;
- int rv;
if ((psock = NNI_ALLOC_STRUCT(psock)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/protocol/pair/pair.c b/src/protocol/pair/pair.c
index ff02c2d1..0d8b32fe 100644
--- a/src/protocol/pair/pair.c
+++ b/src/protocol/pair/pair.c
@@ -45,7 +45,6 @@ static int
nni_pair_sock_init(void **sp, nni_sock *nsock)
{
nni_pair_sock *psock;
- int rv;
if ((psock = NNI_ALLOC_STRUCT(psock)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c
index dc37e72b..20beb873 100644
--- a/src/protocol/pipeline/pull.c
+++ b/src/protocol/pipeline/pull.c
@@ -33,7 +33,6 @@ static int
nni_pull_sock_init(void **pullp, nni_sock *sock)
{
nni_pull_sock *pull;
- int rv;
if ((pull = NNI_ALLOC_STRUCT(pull)) == NULL) {
return (NNG_ENOMEM);
@@ -59,7 +58,6 @@ static int
nni_pull_pipe_init(void **ppp, nni_pipe *pipe, void *psock)
{
nni_pull_pipe *pp;
- int rv;
if ((pp = NNI_ALLOC_STRUCT(pp)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c
index e3b9ace8..4704a323 100644
--- a/src/protocol/pipeline/push.c
+++ b/src/protocol/pipeline/push.c
@@ -240,7 +240,6 @@ nni_push_sock_send(void *arg)
nni_msgq *uwq = push->uwq;
nni_msg *msg = NULL;
nni_mtx *mx = nni_sock_mtx(push->sock);
- int rv;
int i;
for (;;) {
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c
index c9b0ce09..a167d523 100644
--- a/src/protocol/pubsub/pub.c
+++ b/src/protocol/pubsub/pub.c
@@ -41,7 +41,6 @@ static int
nni_pub_sock_init(void **pubp, nni_sock *sock)
{
nni_pub_sock *pub;
- int rv;
if ((pub = NNI_ALLOC_STRUCT(pub)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c
index 0a6ce5fd..9390b0d2 100644
--- a/src/protocol/pubsub/sub.c
+++ b/src/protocol/pubsub/sub.c
@@ -44,7 +44,6 @@ static int
nni_sub_sock_init(void **subp, nni_sock *sock)
{
nni_sub_sock *sub;
- int rv;
if ((sub = NNI_ALLOC_STRUCT(sub)) == NULL) {
return (NNG_ENOMEM);
@@ -79,7 +78,6 @@ static int
nni_sub_pipe_init(void **spp, nni_pipe *pipe, void *ssock)
{
nni_sub_pipe *sp;
- int rv;
if ((sp = NNI_ALLOC_STRUCT(sp)) == NULL) {
return (NNG_ENOMEM);
diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c
index 485fd4bc..90346236 100644
--- a/src/protocol/reqrep/rep.c
+++ b/src/protocol/reqrep/rep.c
@@ -224,7 +224,6 @@ nni_rep_pipe_recv(void *arg)
NNI_PUT32(idbuf, id);
for (;;) {
- size_t len;
uint8_t *body;
int hops;
@@ -323,7 +322,6 @@ static nni_msg *
nni_rep_sock_sfilter(void *arg, nni_msg *msg)
{
nni_rep_sock *rep = arg;
- size_t len;
if (rep->raw) {
return (msg);
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c
index 2359fef1..0cef5a68 100644
--- a/src/protocol/survey/respond.c
+++ b/src/protocol/survey/respond.c
@@ -219,7 +219,6 @@ nni_resp_pipe_recv(void *arg)
NNI_PUT32(idbuf, id);
for (;;) {
- size_t len;
uint8_t *body;
int hops;
@@ -326,7 +325,6 @@ static nni_msg *
nni_resp_sock_sfilter(void *arg, nni_msg *msg)
{
nni_resp_sock *psock = arg;
- size_t len;
if (psock->raw) {
return (msg);
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c
index 3f645d13..d6b1ac74 100644
--- a/src/transport/inproc/inproc.c
+++ b/src/transport/inproc/inproc.c
@@ -269,7 +269,6 @@ nni_inproc_ep_connect(void *arg, void **pipep)
nni_mtx_lock(&nni_inproc.mx);
for (;;) {
nni_inproc_ep *server;
- nni_list *list;
if (ep->closed) {
nni_mtx_unlock(&nni_inproc.mx);
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index 2ddc74b7..4f1a5afa 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -227,7 +227,6 @@ nni_ipc_negotiate(nni_ipc_pipe *pipe)
int rv;
nni_iov iov;
uint8_t buf[8];
- uint16_t peer;
// First send our header..
buf[0] = 0;
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index 8fcf07e5..6c085388 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -270,7 +270,6 @@ nni_tcp_negotiate(nni_tcp_pipe *pipe)
int rv;
nni_iov iov;
uint8_t buf[8];
- uint16_t peer;
// First send our header..
buf[0] = 0;