[Kde-pim] [patch] Bug 71549: QGArray::at: Absolute index out of range

Ingo Klöcker kloecker at kde.org
Mon Feb 12 20:35:41 GMT 2007


On Monday 12 February 2007 08:44, Martin Koller wrote:
> On Sunday 11 February 2007, Ingo Klöcker wrote:
> >      array.resize(size);
> > -    for (int i = 0; i < size; i++)
> > -      array.at(i) = 0;
> > +    memset(array.data(), 0, array.size() * sizeof(KMMsgDictEntry
> > *));  // faster than a loop
> >
> > should probably rather be
> >
> > -    array.resize(size);
> > -    for (int i = 0; i < size; i++)
> > -      array.at(i) = 0;
> > +    array.fill( 0, size );
> >
> > (see http://doc.trolltech.com/3.3/qmemarray.html#fill)
>
> I had a look at the fill() implementation before I used memset, and
> in fact it also uses a loop (at least for a 4 byte pointer type).

Hmm, I wonder why the Trolls use a loop. Anyway, using memset() is okay 
with me.

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20070212/e0f50126/attachment.sig>
-------------- next part --------------
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/


More information about the kde-pim mailing list