From 610cd93c2df0bc40298957681784431a739d3335 Mon Sep 17 00:00:00 2001 From: Dmitry Mikhirev Date: Tue, 28 Oct 2014 22:52:38 +0300 Subject: fix warning --- utf8.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utf8.cpp b/utf8.cpp index e4a295e..ecadb99 100644 --- a/utf8.cpp +++ b/utf8.cpp @@ -88,11 +88,13 @@ wchar_t utf8::get() wchar_t(_string[_index+1] & 0x3f) << 6 | wchar_t(_string[_index+2] & 0x3f); _index += 3; - } else if (((_string[_index] & 0x8) == 0) && (sizeof(code) >= 3)) { +#if WCHAR_MAX - WCHAR_MIN >= 16777215 + } else if ((_string[_index] & 0x8) == 0) { code = wchar_t(_string[_index] & 0x07) << 18 | wchar_t(_string[_index+1] & 0x3f) << 12 | wchar_t(_string[_index+2] & 0x3f) << 6 | wchar_t(_string[_index+3] & 0x3f); +#endif } else { code = '?'; _index++; @@ -111,11 +113,13 @@ wchar_t utf8::get() wchar_t(pgm_read_byte(_string_p + _index + 1) & 0x3f) << 6 | wchar_t(pgm_read_byte(_string_p + _index + 2) & 0x3f); _index += 3; - } else if (((first & 0x8) == 0) && (sizeof(code) >= 3)) { +#if WCHAR_MAX - WCHAR_MIN >= 16777215 + } else if ((first & 0x8) == 0) { code = wchar_t(first & 0x07) << 18 | wchar_t(pgm_read_byte(_string_p + _index + 1) & 0x3f) << 12 | wchar_t(pgm_read_byte(_string_p + _index + 2) & 0x3f) << 6 | wchar_t(pgm_read_byte(_string_p + _index + 3) & 0x3f); +#endif } else { code = '?'; _index++; -- cgit v1.2.1