diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-12-17 09:24:03 +0000 |
---|---|---|
committer | Olivier Crête <olivier.crete@collabora.com> | 2013-12-18 17:50:21 -0500 |
commit | 71fa5bb8716ea311fc3a1d9cc845a123eb8cd4cc (patch) | |
tree | f94b73a042c7e1b32b4a65a71aaef52611966588 /stun | |
parent | bb2763883620976b4ca64c9f4c1871c00d82b994 (diff) | |
download | libnice-71fa5bb8716ea311fc3a1d9cc845a123eb8cd4cc.tar.gz |
Add missing ‘default’ cases to switches
This shuts GCC’s -Wswitch-default warning, and makes the code flow a
little more explicit.
This introduces no functional changes.
Diffstat (limited to 'stun')
-rw-r--r-- | stun/stunmessage.c | 9 | ||||
-rw-r--r-- | stun/tools/stund.c | 8 | ||||
-rw-r--r-- | stun/usages/bind.c | 9 | ||||
-rw-r--r-- | stun/usages/ice.c | 1 | ||||
-rw-r--r-- | stun/usages/turn.c | 8 | ||||
-rw-r--r-- | stun/utils.c | 4 |
6 files changed, 36 insertions, 3 deletions
diff --git a/stun/stunmessage.c b/stun/stunmessage.c index 32e05da..0479fa9 100644 --- a/stun/stunmessage.c +++ b/stun/stunmessage.c @@ -124,6 +124,10 @@ stun_message_find (const StunMessage *msg, StunAttribute type, case STUN_ATTRIBUTE_FINGERPRINT: /* Nothing may come after FPR */ return NULL; + + default: + /* Nothing misordered. */ + break; } if (!(msg->agent && @@ -272,9 +276,10 @@ stun_message_find_addr (const StunMessage *msg, StunAttribute type, memcpy (&ip6->sin6_addr, ptr + 4, 16); return STUN_MESSAGE_RETURN_SUCCESS; } - } - return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; + default: + return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; + } } StunMessageReturn diff --git a/stun/tools/stund.c b/stun/tools/stund.c index d340d19..7338fcf 100644 --- a/stun/tools/stund.c +++ b/stun/tools/stund.c @@ -46,6 +46,7 @@ #ifndef _WIN32 +#include <assert.h> #include <stdio.h> #include <stdint.h> #include <string.h> @@ -125,6 +126,9 @@ int listen_socket (int fam, int type, int proto, unsigned int port) #endif addr.in6.sin6_port = htons (port); break; + + default: + assert (0); /* should never be reached */ } if (bind (fd, (struct sockaddr *)&addr, sizeof (struct sockaddr))) @@ -148,6 +152,9 @@ int listen_socket (int fam, int type, int proto, unsigned int port) setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &yes, sizeof (yes)); #endif break; + + default: + assert (0); /* should never be reached */ } } else @@ -275,6 +282,7 @@ int main (int argc, char *argv[]) switch (c) { + default: case '4': family = AF_INET; break; diff --git a/stun/usages/bind.c b/stun/usages/bind.c index 01f0fec..1750a2b 100644 --- a/stun/usages/bind.c +++ b/stun/usages/bind.c @@ -143,6 +143,10 @@ StunUsageBindReturn stun_usage_bind_process (StunMessage *msg, } return STUN_USAGE_BIND_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); @@ -257,6 +261,9 @@ static int stun_socket (int family, int type, int proto) case AF_INET6: setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &yes, sizeof (yes)); break; + default: + /* Nothing to do. */ + break; } } #endif @@ -500,6 +507,8 @@ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, } continue; case STUN_USAGE_TIMER_RETURN_SUCCESS: + default: + /* Fall through. */ break; } } diff --git a/stun/usages/ice.c b/stun/usages/ice.c index 909bbaa..08210d3 100644 --- a/stun/usages/ice.c +++ b/stun/usages/ice.c @@ -149,6 +149,7 @@ StunUsageIceReturn stun_usage_ice_conncheck_process (StunMessage *msg, break; case STUN_ERROR: + default: if (stun_message_find_error (msg, &code) != STUN_MESSAGE_RETURN_SUCCESS) { /* missing ERROR-CODE: ignore message */ return STUN_USAGE_ICE_RETURN_INVALID; diff --git a/stun/usages/turn.c b/stun/usages/turn.c index 5bcf89b..cf819d5 100644 --- a/stun/usages/turn.c +++ b/stun/usages/turn.c @@ -315,6 +315,10 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg, } return STUN_USAGE_TURN_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); @@ -396,6 +400,10 @@ StunUsageTurnReturn stun_usage_turn_refresh_process (StunMessage *msg, } return STUN_USAGE_TURN_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_message_find32 (msg, STUN_ATTRIBUTE_LIFETIME, lifetime); diff --git a/stun/utils.c b/stun/utils.c index d3fb391..26d7520 100644 --- a/stun/utils.c +++ b/stun/utils.c @@ -117,6 +117,8 @@ StunMessageReturn stun_xor_address (const StunMessage *msg, ip6->sin6_addr.s6_addr[i] ^= msg->buffer[4 + i]; return STUN_MESSAGE_RETURN_SUCCESS; } + + default: + return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; } - return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; } |