mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 23:11:04 +01:00
[iter] Check for more before forwarding/rewinding past ends
This commit is contained in:
1 parent
c1c122e7b3
commit
606841b070
2 files changed
+4
-6
No files matched your search
+2
-2
@@ -196,11 +196,11 @@ struct hb_iter_fallback_mixin_t
|
||||
|
||||
/* Advancing: Implement __next__(), or __forward__() if random-access. */
|
||||
void __next__ () { *thiz() += 1; }
|
||||
void __forward__ (unsigned n) { while (n--) ++*thiz(); }
|
||||
void __forward__ (unsigned n) { while (*thiz() && n--) ++*thiz(); }
|
||||
|
||||
/* Rewinding: Implement __prev__() or __rewind__() if bidirectional. */
|
||||
void __prev__ () { *thiz() -= 1; }
|
||||
void __rewind__ (unsigned n) { while (n--) --*thiz(); }
|
||||
void __rewind__ (unsigned n) { while (*thiz() && n--) --*thiz(); }
|
||||
|
||||
/* Range-based for: Implement __end__() if can be done faster,
|
||||
* and operator!=. */
|
||||
|
||||
+2
-4
@@ -82,10 +82,8 @@ test_iterator_non_default_constructable (Iter it)
|
||||
(void) _;
|
||||
|
||||
it += it.len ();
|
||||
if (0)
|
||||
it = it + 10;
|
||||
if (0)
|
||||
it = 10 + it;
|
||||
it = it + 10;
|
||||
it = 10 + it;
|
||||
|
||||
assert (*it == it[0]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user