From 3b9aab0684bbd2a37abe800be847007d8f221ee8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Mar 2023 16:12:03 +0100 Subject: [PATCH] util/UTF8: fix indent --- src/util/UTF8.cxx | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/util/UTF8.cxx b/src/util/UTF8.cxx index 6dd7df182..814ac3ab2 100644 --- a/src/util/UTF8.cxx +++ b/src/util/UTF8.cxx @@ -272,38 +272,38 @@ Latin1ToUTF8(const char *gcc_restrict src, char *gcc_restrict buffer, char * UnicodeToUTF8(unsigned ch, char *q) noexcept { - if (gcc_likely(ch < 0x80)) { - *q++ = (char)ch; - } else if (gcc_likely(ch < 0x800)) { - *q++ = MakeLeading1(ch >> 6); - *q++ = MakeContinuation(ch); - } else if (ch < 0x10000) { - *q++ = MakeLeading2(ch >> 12); - *q++ = MakeContinuation(ch >> 6); - *q++ = MakeContinuation(ch); - } else if (ch < 0x200000) { - *q++ = MakeLeading3(ch >> 18); - *q++ = MakeContinuation(ch >> 12); - *q++ = MakeContinuation(ch >> 6); - *q++ = MakeContinuation(ch); - } else if (ch < 0x4000000) { - *q++ = MakeLeading4(ch >> 24); - *q++ = MakeContinuation(ch >> 18); - *q++ = MakeContinuation(ch >> 12); - *q++ = MakeContinuation(ch >> 6); - *q++ = MakeContinuation(ch); - } else if (ch < 0x80000000) { - *q++ = MakeLeading5(ch >> 30); - *q++ = MakeContinuation(ch >> 24); - *q++ = MakeContinuation(ch >> 18); - *q++ = MakeContinuation(ch >> 12); - *q++ = MakeContinuation(ch >> 6); - *q++ = MakeContinuation(ch); - } else { - // error - } + if (gcc_likely(ch < 0x80)) { + *q++ = (char)ch; + } else if (gcc_likely(ch < 0x800)) { + *q++ = MakeLeading1(ch >> 6); + *q++ = MakeContinuation(ch); + } else if (ch < 0x10000) { + *q++ = MakeLeading2(ch >> 12); + *q++ = MakeContinuation(ch >> 6); + *q++ = MakeContinuation(ch); + } else if (ch < 0x200000) { + *q++ = MakeLeading3(ch >> 18); + *q++ = MakeContinuation(ch >> 12); + *q++ = MakeContinuation(ch >> 6); + *q++ = MakeContinuation(ch); + } else if (ch < 0x4000000) { + *q++ = MakeLeading4(ch >> 24); + *q++ = MakeContinuation(ch >> 18); + *q++ = MakeContinuation(ch >> 12); + *q++ = MakeContinuation(ch >> 6); + *q++ = MakeContinuation(ch); + } else if (ch < 0x80000000) { + *q++ = MakeLeading5(ch >> 30); + *q++ = MakeContinuation(ch >> 24); + *q++ = MakeContinuation(ch >> 18); + *q++ = MakeContinuation(ch >> 12); + *q++ = MakeContinuation(ch >> 6); + *q++ = MakeContinuation(ch); + } else { + // error + } - return q; + return q; } std::size_t