mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
(trunk libT) Fix an assertion failure in ptrarrays when values are equal.
This bug manifest itself due to a subtle change in tr_compareAddresses(), but was always there. An assertion would fail if two (obviously adjacent) values were equal.
This commit is contained in:
@@ -106,7 +106,7 @@ tr_ptrArrayBack( tr_ptrArray* t )
|
|||||||
|
|
||||||
int
|
int
|
||||||
tr_ptrArrayInsert( tr_ptrArray * t,
|
tr_ptrArrayInsert( tr_ptrArray * t,
|
||||||
void * ptr,
|
void * ptr,
|
||||||
int pos )
|
int pos )
|
||||||
{
|
{
|
||||||
if( pos < 0 || pos > t->n_items )
|
if( pos < 0 || pos > t->n_items )
|
||||||
@@ -119,8 +119,8 @@ tr_ptrArrayInsert( tr_ptrArray * t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memmove( t->items + pos + 1,
|
memmove( t->items + pos + 1,
|
||||||
t->items + pos,
|
t->items + pos,
|
||||||
sizeof( void* ) * ( t->n_items - pos ) );
|
sizeof( void* ) * ( t->n_items - pos ) );
|
||||||
|
|
||||||
t->items[pos] = ptr;
|
t->items[pos] = ptr;
|
||||||
t->n_items++;
|
t->n_items++;
|
||||||
@@ -205,7 +205,7 @@ assertSortedAndUnique( const tr_ptrArray * t,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < t->n_items - 2; ++i )
|
for( i = 0; i < t->n_items - 2; ++i )
|
||||||
assert( compare( t->items[i], t->items[i + 1] ) < 0 );
|
assert( compare( t->items[i], t->items[i + 1] ) <= 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user