Off by one error at the end of reeb and sketch iterators causing despair and dismay.
This commit is contained in:
@@ -1661,9 +1661,9 @@ static void* nextPoint(void *arg)
|
||||
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
|
||||
SK_Point *result = NULL;
|
||||
|
||||
iter->index++;
|
||||
if (iter->index < iter->length)
|
||||
{
|
||||
iter->index++;
|
||||
result = setIteratorValues(iter, iter->index);
|
||||
}
|
||||
|
||||
@@ -1682,11 +1682,6 @@ static void* nextNPoint(void *arg, int n)
|
||||
{
|
||||
result = setIteratorValues(iter, iter->index);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* stop iterator if passed end */
|
||||
iter->index = iter->length;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1724,7 +1719,7 @@ static int iteratorStopped(void *arg)
|
||||
{
|
||||
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
|
||||
|
||||
if (iter->index == iter->length)
|
||||
if (iter->index >= iter->length)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3462,9 +3462,10 @@ static void* nextBucket(void *arg)
|
||||
ReebArcIterator *iter = (ReebArcIterator*)arg;
|
||||
EmbedBucket *result = NULL;
|
||||
|
||||
iter->index++;
|
||||
|
||||
if (iter->index < iter->length)
|
||||
{
|
||||
iter->index++;
|
||||
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
|
||||
}
|
||||
|
||||
@@ -3484,11 +3485,6 @@ static void* nextNBucket(void *arg, int n)
|
||||
{
|
||||
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* stop iterator if passed end */
|
||||
iter->index = iter->length;
|
||||
}
|
||||
|
||||
setIteratorValues(iter, result);
|
||||
return result;
|
||||
@@ -3529,7 +3525,7 @@ static int iteratorStopped(void *arg)
|
||||
{
|
||||
ReebArcIterator *iter = (ReebArcIterator*)arg;
|
||||
|
||||
if (iter->index == iter->length)
|
||||
if (iter->index >= iter->length)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user