diff --git a/src/corelib/text/qstringiterator_p.h b/src/corelib/text/qstringiterator_p.h index 886b2047729..4665d738957 100644 --- a/src/corelib/text/qstringiterator_p.h +++ b/src/corelib/text/qstringiterator_p.h @@ -85,7 +85,7 @@ public: Q_ASSERT_X(hasNext(), Q_FUNC_INFO, "iterator hasn't a next item"); if (Q_UNLIKELY((pos++)->isHighSurrogate())) { - Q_ASSERT(pos < e && pos->isLowSurrogate()); + Q_ASSERT(hasNext() && pos->isLowSurrogate()); ++pos; } } @@ -124,7 +124,7 @@ public: const QChar cur = *pos++; if (Q_UNLIKELY(cur.isHighSurrogate())) { - Q_ASSERT(pos < e && pos->isLowSurrogate()); + Q_ASSERT(hasNext() && pos->isLowSurrogate()); return QChar::surrogateToUcs4(cur, *pos++); } return cur.unicode(); @@ -136,7 +136,7 @@ public: const QChar uc = *pos++; if (Q_UNLIKELY(uc.isSurrogate())) { - if (Q_LIKELY(uc.isHighSurrogate() && pos < e && pos->isLowSurrogate())) + if (Q_LIKELY(uc.isHighSurrogate() && hasNext() && pos->isLowSurrogate())) return QChar::surrogateToUcs4(uc, *pos++); return invalidAs; } @@ -167,7 +167,7 @@ public: Q_ASSERT_X(hasPrevious(), Q_FUNC_INFO, "iterator hasn't a previous item"); if (Q_UNLIKELY((--pos)->isLowSurrogate())) { - Q_ASSERT(pos > i && pos[-1].isHighSurrogate()); + Q_ASSERT(hasPrevious() && pos[-1].isHighSurrogate()); --pos; } } @@ -205,7 +205,7 @@ public: const QChar cur = *--pos; if (Q_UNLIKELY(cur.isLowSurrogate())) { - Q_ASSERT(pos > i && pos[-1].isHighSurrogate()); + Q_ASSERT(hasPrevious() && pos[-1].isHighSurrogate()); return QChar::surrogateToUcs4(*--pos, cur); } return cur.unicode(); @@ -217,7 +217,7 @@ public: const QChar uc = *--pos; if (Q_UNLIKELY(uc.isSurrogate())) { - if (Q_LIKELY(uc.isLowSurrogate() && pos > i && pos[-1].isHighSurrogate())) + if (Q_LIKELY(uc.isLowSurrogate() && hasPrevious() && pos[-1].isHighSurrogate())) return QChar::surrogateToUcs4(*--pos, uc); return invalidAs; }