mirror of
https://github.com/anope/anope.git
synced 2026-06-12 17:24:49 +02:00
Update the vendored libraries.
This commit is contained in:
Vendored
+1
-1
@@ -38,7 +38,7 @@ This directory contains vendored dependencies that are shipped with Anope to avo
|
||||
|
||||
**License** — Boost Software License
|
||||
|
||||
**Version** — v4.0.6
|
||||
**Version** — v4.0.8
|
||||
|
||||
**Website** — [https://github.com/nemtrif/utfcpp](https://github.com/nemtrif/utfcpp)
|
||||
|
||||
|
||||
Vendored
+20
-10
@@ -43,9 +43,14 @@ DEALINGS IN THE SOFTWARE.
|
||||
#if UTF_CPP_CPLUSPLUS >= 201103L // C++ 11 or later
|
||||
#define UTF_CPP_OVERRIDE override
|
||||
#define UTF_CPP_NOEXCEPT noexcept
|
||||
#define UTF_CPP_STATIC_ASSERT(condition) static_assert(condition, "UTFCPP static assert");
|
||||
#else // C++ 98/03
|
||||
#define UTF_CPP_OVERRIDE
|
||||
#define UTF_CPP_NOEXCEPT throw()
|
||||
// Simulate static_assert:
|
||||
template <bool Condition> struct StaticAssert {static void utf8_static_assert() {char static_assert_impl[Condition ? 1 : 0]; } };
|
||||
template <> struct StaticAssert<true> {static void utf8_static_assert() {}};
|
||||
#define UTF_CPP_STATIC_ASSERT(condition) StaticAssert<condition>::utf8_static_assert();
|
||||
#endif // C++ 11 or later
|
||||
|
||||
|
||||
@@ -87,6 +92,7 @@ namespace internal
|
||||
{
|
||||
return static_cast<utfchar8_t>(0xff & oc);
|
||||
}
|
||||
|
||||
template<typename u16_type>
|
||||
inline utfchar16_t mask16(u16_type oc)
|
||||
{
|
||||
@@ -101,17 +107,17 @@ namespace internal
|
||||
|
||||
inline bool is_lead_surrogate(utfchar32_t cp)
|
||||
{
|
||||
return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
|
||||
return (cp >= static_cast<utfchar32_t>(LEAD_SURROGATE_MIN) && cp <= static_cast<utfchar32_t>(LEAD_SURROGATE_MAX));
|
||||
}
|
||||
|
||||
inline bool is_trail_surrogate(utfchar32_t cp)
|
||||
{
|
||||
return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
|
||||
return (cp >= static_cast<utfchar32_t>(TRAIL_SURROGATE_MIN) && cp <= static_cast<utfchar32_t>(TRAIL_SURROGATE_MAX));
|
||||
}
|
||||
|
||||
inline bool is_surrogate(utfchar32_t cp)
|
||||
{
|
||||
return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
|
||||
return (cp >= static_cast<utfchar32_t>(LEAD_SURROGATE_MIN) && cp <= static_cast<utfchar32_t>(TRAIL_SURROGATE_MAX));
|
||||
}
|
||||
|
||||
inline bool is_code_point_valid(utfchar32_t cp)
|
||||
@@ -181,7 +187,7 @@ namespace internal
|
||||
if (it == end)
|
||||
return NOT_ENOUGH_ROOM;
|
||||
|
||||
code_point = utf8::internal::mask8(*it);
|
||||
code_point = static_cast<utfchar32_t>(utf8::internal::mask8(*it));
|
||||
|
||||
return UTF8_OK;
|
||||
}
|
||||
@@ -192,7 +198,7 @@ namespace internal
|
||||
if (it == end)
|
||||
return NOT_ENOUGH_ROOM;
|
||||
|
||||
code_point = utf8::internal::mask8(*it);
|
||||
code_point = static_cast<utfchar32_t>(utf8::internal::mask8(*it));
|
||||
|
||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
||||
|
||||
@@ -207,7 +213,7 @@ namespace internal
|
||||
if (it == end)
|
||||
return NOT_ENOUGH_ROOM;
|
||||
|
||||
code_point = utf8::internal::mask8(*it);
|
||||
code_point = static_cast<utfchar32_t>(utf8::internal::mask8(*it));
|
||||
|
||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
||||
|
||||
@@ -226,7 +232,7 @@ namespace internal
|
||||
if (it == end)
|
||||
return NOT_ENOUGH_ROOM;
|
||||
|
||||
code_point = utf8::internal::mask8(*it);
|
||||
code_point = static_cast<utfchar32_t>(utf8::internal::mask8(*it));
|
||||
|
||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
||||
|
||||
@@ -308,6 +314,10 @@ namespace internal
|
||||
template <typename word_iterator>
|
||||
utf_error validate_next16(word_iterator& it, word_iterator end, utfchar32_t& code_point)
|
||||
{
|
||||
// Make sure the iterator dereferences a large enough type
|
||||
typedef typename std::iterator_traits<word_iterator>::value_type word_type;
|
||||
UTF_CPP_STATIC_ASSERT(sizeof(word_type) >= sizeof(utfchar16_t));
|
||||
// Check the edge case:
|
||||
if (it == end)
|
||||
return NOT_ENOUGH_ROOM;
|
||||
// Save the original value of it so we can go back in case of failure
|
||||
@@ -326,8 +336,8 @@ namespace internal
|
||||
err = NOT_ENOUGH_ROOM;
|
||||
else if (is_lead_surrogate(first_word)) {
|
||||
const utfchar16_t second_word = *it++;
|
||||
if (is_trail_surrogate(second_word)) {
|
||||
code_point = static_cast<utfchar32_t>(first_word << 10) + second_word + SURROGATE_OFFSET;
|
||||
if (is_trail_surrogate(static_cast<utfchar32_t>(second_word))) {
|
||||
code_point = static_cast<utfchar32_t>(first_word << 10) + static_cast<utfchar32_t>(second_word) + SURROGATE_OFFSET;
|
||||
return UTF8_OK;
|
||||
} else
|
||||
err = INCOMPLETE_SEQUENCE;
|
||||
@@ -395,6 +405,7 @@ namespace internal
|
||||
// the word_type.
|
||||
template <typename word_iterator, typename word_type>
|
||||
word_iterator append16(utfchar32_t cp, word_iterator result) {
|
||||
UTF_CPP_STATIC_ASSERT(sizeof(word_type) >= sizeof(utfchar16_t));
|
||||
if (is_in_bmp(cp))
|
||||
*(result++) = static_cast<word_type>(cp);
|
||||
else {
|
||||
@@ -489,4 +500,3 @@ namespace internal
|
||||
|
||||
#endif // header guard
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -82,7 +82,7 @@ namespace utf8
|
||||
template <typename octet_iterator, typename output_iterator>
|
||||
inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
|
||||
{
|
||||
static const utfchar32_t replacement_marker = utf8::internal::mask16(0xfffd);
|
||||
static const utfchar32_t replacement_marker = static_cast<utfchar32_t>(utf8::internal::mask16(0xfffd));
|
||||
return utf8::unchecked::replace_invalid(start, end, out, replacement_marker);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace utf8
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
it++;
|
||||
++it;
|
||||
cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
|
||||
break;
|
||||
case 3:
|
||||
@@ -282,6 +282,5 @@ namespace utf8
|
||||
} // namespace utf8::unchecked
|
||||
} // namespace utf8
|
||||
|
||||
|
||||
#endif // header guard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user