From 2ce9da5fa8e781c34804de9773b6b8f014d6a156 Mon Sep 17 00:00:00 2001 From: Richard Aas Date: Mon, 9 May 2011 11:00:25 +0000 Subject: [PATCH] switch/case formatting style --- src/dbg/dbg.c | 2 ++ src/net/linux/rt.c | 2 ++ src/net/symbian/sif.cpp | 1 + src/net/symbian/snet.cpp | 1 + src/sa/ntop.c | 2 ++ src/sa/pton.c | 1 + src/stun/dnsdisc.c | 2 ++ src/tls/openssl/tls_tcp.c | 3 +++ src/uri/uric.c | 5 +++++ 9 files changed, 19 insertions(+) diff --git a/src/dbg/dbg.c b/src/dbg/dbg.c index c8bd7b0..783f66e 100644 --- a/src/dbg/dbg.c +++ b/src/dbg/dbg.c @@ -144,7 +144,9 @@ static void dbg_vprintf(int level, const char *fmt, va_list ap) dbg_lock(); if (dbg.flags & DBG_ANSI) { + switch (level) { + case DBG_WARNING: (void)re_fprintf(stderr, "\x1b[31m"); /* Red */ break; diff --git a/src/net/linux/rt.c b/src/net/linux/rt.c index 0dcace6..e76ed37 100644 --- a/src/net/linux/rt.c +++ b/src/net/linux/rt.c @@ -119,6 +119,7 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt) case RTA_GATEWAY: switch (rtmsg->rtm_family) { + case AF_INET: sa_init(&rt->gw, AF_INET); rt->gw.u.in.sin_addr.s_addr @@ -146,6 +147,7 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt) case RTA_DST: switch (rtmsg->rtm_family) { + case AF_INET: sa_init(&rt->dst, AF_INET); rt->dst.u.in.sin_addr.s_addr diff --git a/src/net/symbian/sif.cpp b/src/net/symbian/sif.cpp index 6e35ba7..298c675 100644 --- a/src/net/symbian/sif.cpp +++ b/src/net/symbian/sif.cpp @@ -62,6 +62,7 @@ int net_if_debug(struct re_printf *pf, void *unused) err |= re_hprintf(pf, "Interface Name: %s\n", buf); switch (ifinfo().iState) { + case EIfPending: state = "Pending"; break; case EIfUp: state = "Up"; break; case EIfBusy: state = "Busy"; break; diff --git a/src/net/symbian/snet.cpp b/src/net/symbian/snet.cpp index 115aa79..9309ce7 100644 --- a/src/net/symbian/snet.cpp +++ b/src/net/symbian/snet.cpp @@ -34,6 +34,7 @@ static struct sa local_ip; int kerr2errno(int kerr) { switch (kerr) { + case KErrNone: return 0; case KErrNotFound: return ENOENT; case KErrGeneral: return EINVAL; diff --git a/src/sa/ntop.c b/src/sa/ntop.c index 6dcf4b7..47d864b 100644 --- a/src/sa/ntop.c +++ b/src/sa/ntop.c @@ -153,6 +153,7 @@ const char* inet_ntop(int af, const void *src, char *dst, size_t size); const char* inet_ntop(int af, const void *src, char *dst, size_t size) { switch (af) { + case AF_INET: return inet_ntop4(src, dst, size); @@ -190,6 +191,7 @@ int net_inet_ntop(const struct sa *sa, char *buf, int size) return EINVAL; switch (sa->u.sa.sa_family) { + case AF_INET: inet_ntop(AF_INET, &sa->u.in.sin_addr, buf, size); break; diff --git a/src/sa/pton.c b/src/sa/pton.c index 04c5463..ed00027 100644 --- a/src/sa/pton.c +++ b/src/sa/pton.c @@ -193,6 +193,7 @@ static int inet_pton(int af, const char *src, void *dst) return 0; switch (af) { + case AF_INET: return inet_pton4(src, (u_char*) dst); diff --git a/src/stun/dnsdisc.c b/src/stun/dnsdisc.c index 15c0746..855aa64 100644 --- a/src/stun/dnsdisc.c +++ b/src/stun/dnsdisc.c @@ -111,6 +111,7 @@ static int a_or_aaaa_query(struct stun_dns *dns, const char *name) dns->dq = mem_deref(dns->dq); switch (dns->af) { + case AF_INET: return dnsc_query(&dns->dq, dns->dnsc, name, DNS_TYPE_A, DNS_CLASS_IN, true, a_handler, dns); @@ -158,6 +159,7 @@ static void srv_handler(int err, const struct dnshdr *hdr, struct list *ansl, /* Look for Additional information */ switch (dns->af) { + case AF_INET: arr = dns_rrlist_find(addl, rr->rdata.srv.target, DNS_TYPE_A, DNS_CLASS_IN, true); diff --git a/src/tls/openssl/tls_tcp.c b/src/tls/openssl/tls_tcp.c index 2021b98..fc43833 100644 --- a/src/tls/openssl/tls_tcp.c +++ b/src/tls/openssl/tls_tcp.c @@ -56,6 +56,7 @@ static int tls_connect(struct tls_conn *tc) const int ssl_err = SSL_get_error(tc->ssl, r); switch (ssl_err) { + case SSL_ERROR_WANT_READ: break; @@ -80,6 +81,7 @@ static int tls_accept(struct tls_conn *tc) const int ssl_err = SSL_get_error(tc->ssl, r); switch (ssl_err) { + case SSL_ERROR_WANT_READ: break; @@ -166,6 +168,7 @@ static bool recv_handler(int *err, struct mbuf *mb, bool *estab, void *arg) const int ssl_err = SSL_get_error(tc->ssl, n); switch (ssl_err) { + case SSL_ERROR_WANT_READ: break; diff --git a/src/uri/uric.c b/src/uri/uric.c index 509a499..e00350d 100644 --- a/src/uri/uric.c +++ b/src/uri/uric.c @@ -21,6 +21,7 @@ typedef bool (esc_h)(char c); static bool is_mark(int c) { switch (c) { + case '-': case '_': case '.': @@ -46,6 +47,7 @@ static bool is_unreserved(char c) static bool is_user_unreserved(int c) { switch (c) { + case '&': case '=': case '+': @@ -63,6 +65,7 @@ static bool is_user_unreserved(int c) static bool is_hnv_unreserved(char c) { switch (c) { + case '[': case ']': case '/': @@ -86,6 +89,7 @@ static bool is_user(char c) static bool is_password(char c) { switch (c) { + case '&': case '=': case '+': @@ -101,6 +105,7 @@ static bool is_password(char c) static bool is_param_unreserved(char c) { switch (c) { + case '[': case ']': case '/':