diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-01 21:32:54 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-01 22:18:16 +0100 |
commit | fb8a9fc9b5ec53b13f9c2acad48b9a7f6579acfa (patch) | |
tree | c2b0e117cb76a2a40420c5ad4b3878b19d152f3f /src | |
parent | 1e5b6b4f2861ad2b31571065b60b05fca85047b1 (diff) |
resolve: work around clang limitation
clang is apparently not smart enough to detect when a switch statement contains case statements for all possible values
of the used type. Work around that.
(And while we are at it, normalize indentation a bit)
Fixes: #2504
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve/dns-type.c | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/src/resolve/dns-type.c b/src/resolve/dns-type.c index fc2f1826fd..49210b2ca9 100644 --- a/src/resolve/dns-type.c +++ b/src/resolve/dns-type.c @@ -240,31 +240,69 @@ int dns_class_from_string(const char *s) { } const char* tlsa_cert_usage_to_string(uint8_t cert_usage) { - switch(cert_usage) { - case 0: return "CA constraint"; - case 1: return "Service certificate constraint"; - case 2: return "Trust anchor assertion"; - case 3: return "Domain-issued certificate"; - case 4 ... 254: return "Unassigned"; - case 255: return "Private use"; + + switch (cert_usage) { + + case 0: + return "CA constraint"; + + case 1: + return "Service certificate constraint"; + + case 2: + return "Trust anchor assertion"; + + case 3: + return "Domain-issued certificate"; + + case 4 ... 254: + return "Unassigned"; + + case 255: + return "Private use"; } + + return NULL; /* clang cannot count that we covered everything */ } const char* tlsa_selector_to_string(uint8_t selector) { - switch(selector) { - case 0: return "Full Certificate"; - case 1: return "SubjectPublicKeyInfo"; - case 2 ... 254: return "Unassigned"; - case 255: return "Private use"; + switch (selector) { + + case 0: + return "Full Certificate"; + + case 1: + return "SubjectPublicKeyInfo"; + + case 2 ... 254: + return "Unassigned"; + + case 255: + return "Private use"; } + + return NULL; } const char* tlsa_matching_type_to_string(uint8_t selector) { - switch(selector) { - case 0: return "No hash used"; - case 1: return "SHA-256"; - case 2: return "SHA-512"; - case 3 ... 254: return "Unassigned"; - case 255: return "Private use"; + + switch (selector) { + + case 0: + return "No hash used"; + + case 1: + return "SHA-256"; + + case 2: + return "SHA-512"; + + case 3 ... 254: + return "Unassigned"; + + case 255: + return "Private use"; } + + return NULL; } |