On Sat, Jul 28, 2001 at 03:40:10AM -0500, xOr wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I've found a problem in LinkedList.cc:
> 
> check out line 164:
>       __llist_node *nnode = new __llist_node, *inode = _first->getNext();
> how this function works is, if 0 is passed in as the index to insert to,
> then the new item is added at the top of the list.
> So, the highest in the list one can insert after the top is, of course, at
> index 1.
> The above line sets inode to _first->getNext, the _second_ element in the
> linked list.
> If an index of 1 is passed in, then inode is not modified and the new node
> is added after inode.
> This makes the new node go into index 2, not index 1.
> A simple fix for this is to change line 164 to:
>       __llist_node *nnode = new __llist_node, *inode = _first;
> 
> This probly affects most of the bbtools and maybe blackbox itself.. as all
> insertions into the linked list have been at (index+1).
> 
> xOr

Yeah, I ran into this a while back when tracking down a bug
with blackbox's timers (for the most part, I think that's the
only part of blackbox really impacted by the code, since most
of the inserts blackbox does are appends). I've actually got
the code using a new linked list implementation now (back to
a doubly linked implementation).

Jeff Raven

Reply via email to