summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-08-02 12:52:22 +0100
committerPeter Powell <petpow@saberuk.com>2019-08-02 12:52:22 +0100
commit4f4bc07f41bf0ebc1a97da097cbddf5fdf6531bf (patch)
treef9dd47e649016cc7281af110a3c60f3b2acbeb95 /vendor
parentcb1e9772a9526da37b7a155109bb481d56d97f5b (diff)
Update vendored utfcpp to v3.1.
Diffstat (limited to 'vendor')
-rw-r--r--vendor/README.md2
-rw-r--r--vendor/utfcpp/utf8/unchecked.h42
2 files changed, 42 insertions, 2 deletions
diff --git a/vendor/README.md b/vendor/README.md
index a97e99c18..9d148c7b3 100644
--- a/vendor/README.md
+++ b/vendor/README.md
@@ -36,7 +36,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to
**Author** &mdash; Nemanja Trifunovic
-**Last Updated** &mdash; 2019-04-25 (ad27c7d5e0e5b4c3baca4a2e70c0336b68c0dffb)
+**Last Updated** &mdash; 2019-08-02 (v3.1)
**License** &mdash; Boost Software License
diff --git a/vendor/utfcpp/utf8/unchecked.h b/vendor/utfcpp/utf8/unchecked.h
index c78419f69..def000997 100644
--- a/vendor/utfcpp/utf8/unchecked.h
+++ b/vendor/utfcpp/utf8/unchecked.h
@@ -32,7 +32,7 @@ DEALINGS IN THE SOFTWARE.
namespace utf8
{
- namespace unchecked
+ namespace unchecked
{
template <typename octet_iterator>
octet_iterator append(uint32_t cp, octet_iterator result)
@@ -57,6 +57,46 @@ namespace utf8
return result;
}
+ template <typename octet_iterator, typename output_iterator>
+ output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
+ {
+ while (start != end) {
+ octet_iterator sequence_start = start;
+ internal::utf_error err_code = utf8::internal::validate_next(start, end);
+ switch (err_code) {
+ case internal::UTF8_OK :
+ for (octet_iterator it = sequence_start; it != start; ++it)
+ *out++ = *it;
+ break;
+ case internal::NOT_ENOUGH_ROOM:
+ out = utf8::unchecked::append (replacement, out);
+ start = end;
+ break;
+ case internal::INVALID_LEAD:
+ out = utf8::unchecked::append (replacement, out);
+ ++start;
+ break;
+ case internal::INCOMPLETE_SEQUENCE:
+ case internal::OVERLONG_SEQUENCE:
+ case internal::INVALID_CODE_POINT:
+ out = utf8::unchecked::append (replacement, out);
+ ++start;
+ // just one replacement mark for the sequence
+ while (start != end && utf8::internal::is_trail(*start))
+ ++start;
+ break;
+ }
+ }
+ return out;
+ }
+
+ template <typename octet_iterator, typename output_iterator>
+ inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
+ {
+ static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd);
+ return utf8::unchecked::replace_invalid(start, end, out, replacement_marker);
+ }
+
template <typename octet_iterator>
uint32_t next(octet_iterator& it)
{