diff --git a/source/utf8/checked.h b/source/utf8/checked.h index ff75eb7..e93819c 100644 --- a/source/utf8/checked.h +++ b/source/utf8/checked.h @@ -249,7 +249,7 @@ namespace utf8 template u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) { - while (start < end) + while (start != end) (*result++) = next(start, end); return result; diff --git a/source/utf8/unchecked.h b/source/utf8/unchecked.h index d3110cb..2f3eb4d 100644 --- a/source/utf8/unchecked.h +++ b/source/utf8/unchecked.h @@ -144,7 +144,7 @@ namespace utf8 template u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) { - while (start != end) { + while (start < end) { uint32_t cp = next(start); if (cp > 0xffff) { //make a surrogate pair *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET);