aboutsummaryrefslogtreecommitdiffstats
path: root/src/implementation.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-02 21:52:20 +0100
committerDavid Robillard <d@drobilla.net>2021-01-02 21:52:20 +0100
commit59296974c71dfc7db7d003b40af84fa36a5e93c6 (patch)
treeda05c022c534e8bd1d2800310e9c80c4d98c6046 /src/implementation.c
parent416478739315ca41ad236197b25f87b83ab7f312 (diff)
downloadpugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.gz
pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.tar.bz2
pugl-59296974c71dfc7db7d003b40af84fa36a5e93c6.zip
Avoid "else" after "return"
Diffstat (limited to 'src/implementation.c')
-rw-r--r--src/implementation.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/implementation.c b/src/implementation.c
index a6d8393..79ac5d6 100644
--- a/src/implementation.c
+++ b/src/implementation.c
@@ -320,19 +320,27 @@ puglDecodeUTF8(const uint8_t* buf)
if (buf[0] < 0x80) {
return buf[0];
- } else if (buf[0] < 0xC2) {
+ }
+
+ if (buf[0] < 0xC2) {
return 0xFFFD;
- } else if (buf[0] < 0xE0) {
+ }
+
+ if (buf[0] < 0xE0) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u;
- } else if (buf[0] < 0xF0) {
+ }
+
+ if (buf[0] < 0xF0) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0);
FAIL_IF((buf[2] & 0xC0u) != 0x80);
return ((uint32_t)buf[0] << 12u) + //
((uint32_t)buf[1] << 6u) + //
((uint32_t)buf[2] - 0xE2080u);
- } else if (buf[0] < 0xF5) {
+ }
+
+ if (buf[0] < 0xF5) {
FAIL_IF((buf[1] & 0xC0u) != 0x80);
FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90);
FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90);
@@ -343,6 +351,7 @@ puglDecodeUTF8(const uint8_t* buf)
((uint32_t)buf[2] << 6u) + //
((uint32_t)buf[3] - 0x3C82080u));
}
+
return 0xFFFD;
}