From 7c41f51d56def646522b0f49d8b3b9e18233c80b Mon Sep 17 00:00:00 2001 From: ntrifunovic Date: Mon, 7 Dec 2009 01:34:23 +0000 Subject: [PATCH] Fix for the bug [ID: 2906315]: < instead != in utf8to32 git-svn-id: http://svn.code.sf.net/p/utfcpp/code@107 a809a056-fc17-0410-9590-b4f493f8b08e --- source/utf8/checked.h | 2 +- source/utf8/unchecked.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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);