Clang 14 on macOS 12.7.4 (and I guess also newer versions) emits these warnings when compiling nbd-server.c:
CC nbd_server-nbd-server.o
nbd-server.c:2885:15: warning: & has lower precedence than !=; != will be evaluated first [-Wparentheses]
if(req->type & NBD_CMD_FLAG_DF != 0) {
^~~~~~~~~~~~~~~~~~~~~~
nbd-server.c:2885:15: note: place parentheses around the '!=' expression to silence this warning
if(req->type & NBD_CMD_FLAG_DF != 0) {
^ ~~~~~~~~~~~~~~~~~~~~
nbd-server.c:2885:15: note: place parentheses around the & expression to evaluate it first
if(req->type & NBD_CMD_FLAG_DF != 0) {
~~~~~~~~~~^~~~~~~~~~~~~~~~~
nbd-server.c:3315:10: warning: result of comparison of constant 18446744073709551614 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
if (len >= ULONG_MAX - 1) {
~~~ ^ ~~~~~~~~~~~~~
This commit will address these 2 warnings and fix the code.
Clang 14 on macOS 12.7.4 (and I guess also newer versions) emits these warnings when compiling nbd-server.c:
This commit will address these 2 warnings and fix the code.