From 122a291eda2992f81d31f65d9c0bd82bc7180dff Mon Sep 17 00:00:00 2001 From: lyk Date: Fri, 12 Apr 2024 20:57:51 +0800 Subject: [PATCH] clang format --- 3rdparty/utf8/checked.h | 1 - 3rdparty/utf8/core.h | 28 +++++++++++++--------------- 3rdparty/utf8/cpp11.h | 1 - 3rdparty/utf8/cpp17.h | 3 +-- 3rdparty/utf8/cpp20.h | 3 +-- 3rdparty/utf8/unchecked.h | 19 +++++++++---------- 6 files changed, 24 insertions(+), 31 deletions(-) diff --git a/3rdparty/utf8/checked.h b/3rdparty/utf8/checked.h index 98949f8..0613101 100644 --- a/3rdparty/utf8/checked.h +++ b/3rdparty/utf8/checked.h @@ -356,4 +356,3 @@ namespace utf8 #endif // C++ 11 or later #endif //header guard - diff --git a/3rdparty/utf8/core.h b/3rdparty/utf8/core.h index 4494c53..1acbdea 100644 --- a/3rdparty/utf8/core.h +++ b/3rdparty/utf8/core.h @@ -143,15 +143,15 @@ namespace internal inline bool is_overlong_sequence(utfchar32_t cp, int length) { if (cp < 0x80) { - if (length != 1) + if (length != 1) return true; } else if (cp < 0x800) { - if (length != 2) + if (length != 2) return true; } else if (cp < 0x10000) { - if (length != 3) + if (length != 3) return true; } return false; @@ -189,7 +189,7 @@ namespace internal template utf_error get_sequence_2(octet_iterator& it, octet_iterator end, utfchar32_t& code_point) { - if (it == end) + if (it == end) return NOT_ENOUGH_ROOM; code_point = utf8::internal::mask8(*it); @@ -206,7 +206,7 @@ namespace internal { if (it == end) return NOT_ENOUGH_ROOM; - + code_point = utf8::internal::mask8(*it); UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) @@ -290,7 +290,7 @@ namespace internal else err = OVERLONG_SEQUENCE; } - else + else err = INVALID_CODE_POINT; } @@ -329,11 +329,11 @@ namespace internal if (is_trail_surrogate(second_word)) { code_point = (first_word << 10) + second_word + SURROGATE_OFFSET; return UTF8_OK; - } else - err = INCOMPLETE_SEQUENCE; - + } else + err = INCOMPLETE_SEQUENCE; + } else { - err = INVALID_LEAD; + err = INVALID_LEAD; } } // error branch @@ -365,7 +365,7 @@ namespace internal } return result; } - + // One of the following overloads will be invoked from the API calls // A simple (but dangerous) case: the caller appends byte(s) to a char array @@ -444,7 +444,7 @@ namespace internal inline const char* find_invalid(const char* str) { const char* end = str + std::strlen(str); - return find_invalid(str, end); + return find_invalid(str, end); } inline std::size_t find_invalid(const std::string& s) @@ -484,9 +484,7 @@ namespace internal inline bool starts_with_bom(const std::string& s) { return starts_with_bom(s.begin(), s.end()); - } + } } // namespace utf8 #endif // header guard - - diff --git a/3rdparty/utf8/cpp11.h b/3rdparty/utf8/cpp11.h index 691633c..a0b4b12 100644 --- a/3rdparty/utf8/cpp11.h +++ b/3rdparty/utf8/cpp11.h @@ -67,4 +67,3 @@ namespace utf8 } // namespace utf8 #endif // header guard - diff --git a/3rdparty/utf8/cpp17.h b/3rdparty/utf8/cpp17.h index 6e2fcc2..567b23d 100644 --- a/3rdparty/utf8/cpp17.h +++ b/3rdparty/utf8/cpp17.h @@ -89,8 +89,7 @@ namespace utf8 { return starts_with_bom(s.begin(), s.end()); } - + } // namespace utf8 #endif // header guard - diff --git a/3rdparty/utf8/cpp20.h b/3rdparty/utf8/cpp20.h index 07b61d0..700897f 100644 --- a/3rdparty/utf8/cpp20.h +++ b/3rdparty/utf8/cpp20.h @@ -117,8 +117,7 @@ namespace utf8 { return starts_with_bom(s.begin(), s.end()); } - + } // namespace utf8 #endif // header guard - diff --git a/3rdparty/utf8/unchecked.h b/3rdparty/utf8/unchecked.h index 65d4948..dba2501 100644 --- a/3rdparty/utf8/unchecked.h +++ b/3rdparty/utf8/unchecked.h @@ -112,18 +112,18 @@ namespace utf8 cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); break; case 3: - ++it; + ++it; cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); ++it; cp += (*it) & 0x3f; break; case 4: ++it; - cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); + cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); ++it; cp += (utf8::internal::mask8(*it) << 6) & 0xfff; ++it; - cp += (*it) & 0x3f; + cp += (*it) & 0x3f; break; } ++it; @@ -173,7 +173,7 @@ namespace utf8 distance(octet_iterator first, octet_iterator last) { typename std::iterator_traits::difference_type dist; - for (dist = 0; first < last; ++dist) + for (dist = 0; first < last; ++dist) utf8::unchecked::next(first); return dist; } @@ -247,15 +247,15 @@ namespace utf8 octet_iterator temp = it; return utf8::unchecked::next(temp); } - bool operator == (const iterator& rhs) const - { + bool operator == (const iterator& rhs) const + { return (it == rhs.it); } bool operator != (const iterator& rhs) const { return !(operator == (rhs)); } - iterator& operator ++ () + iterator& operator ++ () { ::std::advance(it, utf8::internal::sequence_length(it)); return *this; @@ -265,7 +265,7 @@ namespace utf8 iterator temp = *this; ::std::advance(it, utf8::internal::sequence_length(it)); return temp; - } + } iterator& operator -- () { utf8::unchecked::prior(it); @@ -280,8 +280,7 @@ namespace utf8 }; // class iterator } // namespace utf8::unchecked -} // namespace utf8 +} // namespace utf8 #endif // header guard -