mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Update vendored dependencies.
This commit is contained in:
parent
9b5c86c0b6
commit
5894b4eb80
2
vendor/README.md
vendored
2
vendor/README.md
vendored
@ -38,7 +38,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to
|
||||
|
||||
**License** — Boost Software License
|
||||
|
||||
**Version** — v3.2.1
|
||||
**Version** — v3.2.3
|
||||
|
||||
**Website** — [https://github.com/nemtrif/utfcpp](https://github.com/nemtrif/utfcpp)
|
||||
|
||||
|
49
vendor/utfcpp/core.h
vendored
49
vendor/utfcpp/core.h
vendored
@ -297,6 +297,55 @@ namespace internal
|
||||
return utf8::internal::validate_next(it, end, ignored);
|
||||
}
|
||||
|
||||
// Internal implementation of both checked and unchecked append() function
|
||||
// This function will be invoked by the overloads below, as they will know
|
||||
// the octet_type.
|
||||
template <typename octet_iterator, typename octet_type>
|
||||
octet_iterator append(uint32_t cp, octet_iterator result) {
|
||||
if (cp < 0x80) // one octet
|
||||
*(result++) = static_cast<octet_type>(cp);
|
||||
else if (cp < 0x800) { // two octets
|
||||
*(result++) = static_cast<octet_type>((cp >> 6) | 0xc0);
|
||||
*(result++) = static_cast<octet_type>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
else if (cp < 0x10000) { // three octets
|
||||
*(result++) = static_cast<octet_type>((cp >> 12) | 0xe0);
|
||||
*(result++) = static_cast<octet_type>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<octet_type>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
else { // four octets
|
||||
*(result++) = static_cast<octet_type>((cp >> 18) | 0xf0);
|
||||
*(result++) = static_cast<octet_type>(((cp >> 12) & 0x3f)| 0x80);
|
||||
*(result++) = static_cast<octet_type>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<octet_type>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
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
|
||||
inline char* append(uint32_t cp, char* result) {
|
||||
return append<char*, char>(cp, result);
|
||||
}
|
||||
|
||||
// Hopefully, most common case: the caller uses back_inserter
|
||||
// i.e. append(cp, std::back_inserter(str));
|
||||
template<typename container_type>
|
||||
std::back_insert_iterator<container_type> append
|
||||
(uint32_t cp, std::back_insert_iterator<container_type> result) {
|
||||
return append<std::back_insert_iterator<container_type>,
|
||||
typename container_type::value_type>(cp, result);
|
||||
}
|
||||
|
||||
// The caller uses some other kind of output operator - not covered above
|
||||
// Note that in this case we are not able to determine octet_type
|
||||
// so we assume it's uint_8; that can cause a conversion warning if we are wrong.
|
||||
template <typename octet_iterator>
|
||||
octet_iterator append(uint32_t cp, octet_iterator result) {
|
||||
return append<octet_iterator, uint8_t>(cp, result);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
/// The library API - functions intended to be called by the users
|
||||
|
19
vendor/utfcpp/unchecked.h
vendored
19
vendor/utfcpp/unchecked.h
vendored
@ -37,24 +37,7 @@ namespace utf8
|
||||
template <typename octet_iterator>
|
||||
octet_iterator append(uint32_t cp, octet_iterator result)
|
||||
{
|
||||
if (cp < 0x80) // one octet
|
||||
*(result++) = static_cast<uint8_t>(cp);
|
||||
else if (cp < 0x800) { // two octets
|
||||
*(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
|
||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
else if (cp < 0x10000) { // three octets
|
||||
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
|
||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
else { // four octets
|
||||
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
|
||||
*(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)| 0x80);
|
||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
||||
}
|
||||
return result;
|
||||
return internal::append(cp, result);
|
||||
}
|
||||
|
||||
template <typename octet_iterator, typename output_iterator>
|
||||
|
Loading…
x
Reference in New Issue
Block a user