Title: [203208] trunk/Source/WTF
- Revision
- 203208
- Author
- mmaxfi...@apple.com
- Date
- 2016-07-13 19:01:33 -0700 (Wed, 13 Jul 2016)
Log Message
Addressing post-review comments after r203119
https://bugs.webkit.org/show_bug.cgi?id=159749
Unreviewed.
* wtf/text/StringView.h:
(WTF::StringView::CodePoints::Iterator::Iterator):
(WTF::StringView::CodePoints::Iterator::operator*):
(WTF::StringView::CodePoints::Iterator::operator==):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (203207 => 203208)
--- trunk/Source/WTF/ChangeLog 2016-07-14 01:45:18 UTC (rev 203207)
+++ trunk/Source/WTF/ChangeLog 2016-07-14 02:01:33 UTC (rev 203208)
@@ -1,3 +1,15 @@
+2016-07-13 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Addressing post-review comments after r203119
+ https://bugs.webkit.org/show_bug.cgi?id=159749
+
+ Unreviewed.
+
+ * wtf/text/StringView.h:
+ (WTF::StringView::CodePoints::Iterator::Iterator):
+ (WTF::StringView::CodePoints::Iterator::operator*):
+ (WTF::StringView::CodePoints::Iterator::operator==):
+
2016-07-13 Enrica Casucci <enr...@apple.com>
Update supported platforms in xcconfig files to match the sdk names.
Modified: trunk/Source/WTF/wtf/text/StringView.h (203207 => 203208)
--- trunk/Source/WTF/wtf/text/StringView.h 2016-07-14 01:45:18 UTC (rev 203207)
+++ trunk/Source/WTF/wtf/text/StringView.h 2016-07-14 02:01:33 UTC (rev 203208)
@@ -654,8 +654,7 @@
private:
const StringView& m_stringView;
- unsigned m_index;
- unsigned m_indexEnd;
+ Optional<unsigned> m_nextCodePointOffset;
UChar32 m_codePoint;
};
@@ -711,8 +710,7 @@
inline StringView::CodePoints::Iterator::Iterator(const StringView& stringView, unsigned index)
: m_stringView(stringView)
- , m_index(index)
- , m_indexEnd(index)
+ , m_nextCodePointOffset(index)
{
operator++();
}
@@ -719,22 +717,22 @@
inline auto StringView::CodePoints::Iterator::operator++() -> Iterator&
{
- ASSERT(m_indexEnd <= m_stringView.length());
- m_index = m_indexEnd;
- if (m_indexEnd == m_stringView.length()) {
- m_codePoint = 0;
+ ASSERT(m_nextCodePointOffset);
+ if (m_nextCodePointOffset.value() == m_stringView.length()) {
+ m_nextCodePointOffset = Nullopt;
return *this;
}
if (m_stringView.is8Bit())
- m_codePoint = m_stringView.characters8()[m_indexEnd++];
+ m_codePoint = m_stringView.characters8()[m_nextCodePointOffset.value()++];
else
- U16_NEXT(m_stringView.characters16(), m_indexEnd, m_stringView.length(), m_codePoint);
+ U16_NEXT(m_stringView.characters16(), m_nextCodePointOffset.value(), m_stringView.length(), m_codePoint);
+ ASSERT(m_nextCodePointOffset.value() <= m_stringView.length());
return *this;
}
inline UChar32 StringView::CodePoints::Iterator::operator*() const
{
- ASSERT(m_indexEnd <= m_stringView.length());
+ ASSERT(m_nextCodePointOffset);
return m_codePoint;
}
@@ -741,7 +739,7 @@
inline bool StringView::CodePoints::Iterator::operator==(const Iterator& other) const
{
ASSERT(&m_stringView == &other.m_stringView);
- return m_index == other.m_index;
+ return m_nextCodePointOffset == other.m_nextCodePointOffset;
}
inline bool StringView::CodePoints::Iterator::operator!=(const Iterator& other) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes