diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-02-14 14:50:04 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-02-14 18:28:36 -0800 |
| commit | 45bc175ef9278c175d2fc3a0678b49b18e74c449 (patch) | |
| tree | b1838778ee898112f28b35178364068c6f48c9b4 /tests/sock.c | |
| parent | 8f93750ed2a6aaa1749eb689ddf119280f9aac7a (diff) | |
| download | nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.gz nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.bz2 nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.zip | |
fixes #234 Investigate enabling more verbose compiler warnings
We enabled verbose compiler warnings, and found a lot of issues.
Some of these were even real bugs. As a bonus, we actually save
some initialization steps in the compat layer, and avoid passing
some variables we don't need.
Diffstat (limited to 'tests/sock.c')
| -rw-r--r-- | tests/sock.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/sock.c b/tests/sock.c index d3af414a..404e160b 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -75,8 +75,6 @@ TestMain("Socket Operations", { Convey("We can set and get options", { nng_duration to = 1234; - int64_t v = 0; - size_t sz; So(nng_setopt_ms(s1, NNG_OPT_SENDTIMEO, to) == 0); @@ -99,7 +97,7 @@ TestMain("Socket Operations", { s1, NNG_OPT_SOCKNAME, name, &sz) == 0); So(sz > 0 && sz < 64); So(sz == nni_strnlen(name, 64) + 1); - So(atoi(name) == (unsigned) s1); + So(atoi(name) == (int) s1); So(nng_setopt( s1, NNG_OPT_SOCKNAME, "hello", 6) == 0); @@ -164,6 +162,8 @@ TestMain("Socket Operations", { Convey("We can apply options before endpoint", { nng_listener l; char addr[NNG_MAXADDRLEN]; + size_t sz; + trantest_next_address( addr, "ipc:///tmp/lopt_%u"); @@ -194,8 +194,8 @@ TestMain("Socket Operations", { }); }); Convey("Short size is not copied", { - sz = 0; - to = 0; + size_t sz = 0; + to = 0; So(nng_getopt( s1, NNG_OPT_SENDTIMEO, &to, &sz) == 0); So(sz == sizeof(to)); @@ -212,7 +212,7 @@ TestMain("Socket Operations", { }); Convey("Correct size is copied", { - sz = sizeof(to); + size_t sz = sizeof(to); So(nng_getopt( s1, NNG_OPT_SENDTIMEO, &to, &sz) == 0); So(sz == sizeof(to)); @@ -220,8 +220,8 @@ TestMain("Socket Operations", { }); Convey("Short size buf is not copied", { - int l = 5; - sz = 0; + int l = 5; + size_t sz = 0; So(nng_getopt(s1, NNG_OPT_RECVBUF, &l, &sz) == 0); So(sz == sizeof(l)); @@ -241,8 +241,8 @@ TestMain("Socket Operations", { }); Convey("Short timeout fails", { - to = 0; - sz = sizeof(to) - 1; + size_t sz = sizeof(to) - 1; + to = 0; So(nng_setopt(s1, NNG_OPT_RECVTIMEO, &to, sz) == NNG_EINVAL); So(nng_setopt(s1, NNG_OPT_RECONNMINT, &to, |
