chiark / gitweb /
udp.c: Add explicit cast to muffle bogus Clang warning.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 19 Sep 2019 20:01:24 +0000 (20:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 21 Sep 2019 10:06:45 +0000 (11:06 +0100)
commitf3b9bc33b5e1b1549da6b80c3a5952462afe8c1e
tree24e35b7e05cc27f4e9b57628d2ed74c920c65145
parent5ffc82e77c4ba6b9cb7bd93f4bd76798c085128e
udp.c: Add explicit cast to muffle bogus Clang warning.

Clang is complaining (`-Wsign-compare') about the comparison between
`salen' (`socklen_t', i.e., an `int' with a false moustache) and
`size_t' (`unsigned int' in this case).  I can see that some warnings of
this kind are useful, but not this one.  The usual arithmetic
conversions apply, so `salen' is converted to `size_t'.  If it was
negative before, it's now very positive, which will trip the the
comparison and call `FAIL' -- which seems like a plausible outcome.

Muffle the warning by adding an explicit cast.  This is ugly and
pointless, though: other suggestions are welcome.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
udp.c