About b3dpolygon.cxx (basegfx)
Rodolfo
rodolforg at gmail.com
Mon Apr 1 09:56:55 PDT 2013
You're right on both cases...
Em 01/04/2013 08:53, "julien2412" <serval2412 at yahoo.fr> escreveu:
> Hello,
>
> There are a lot of iterators stuff in
> core/basegfx/source/polygon/b3dpolygon.cxx, I tried to fix 'prefix ++/--
> operators for non-primitive types' errors (provided by cppcheck) but I saw
> several iterator things I'm not sure, eg:
> 274 BColorArray(const BColorArray& rOriginal, sal_uInt32 nIndex,
> sal_uInt32 nCount)
> 275 : maVector(),
> 276 mnUsedEntries(0L)
> 277 {
> 278 BColorDataVector::const_iterator
> aStart(rOriginal.maVector.begin());
> 279 aStart += nIndex;
> 280 BColorDataVector::const_iterator aEnd(aStart);
> 281 aEnd += nCount;
> 282 maVector.reserve(nCount);
> 283
> 284 for(; aStart != aEnd; ++aStart)
> 285 {
> 286 if(!aStart->equalZero())
> 287 mnUsedEntries++;
> 288
> 289 maVector.push_back(*aStart);
> 290 }
> 291 }
> Isn't aEnd invalidated by push_back call?
> Isn't aEnd += nCount dangerous? (if aEnd tries to go further than
> rOriginal.maVector.end())
>
> 358 void insert(sal_uInt32 nIndex, const BColorArray& rSource)
> 359 {
> 360 const sal_uInt32 nCount(rSource.maVector.size());
> 361
> 362 if(nCount)
> 363 {
> 364 // insert data
> 365 BColorDataVector::iterator aIndex(maVector.begin());
> 366 aIndex += nIndex;
> 367 BColorDataVector::const_iterator
> aStart(rSource.maVector.begin());
> 368 BColorDataVector::const_iterator
> aEnd(rSource.maVector.end());
> 369 maVector.insert(aIndex, aStart, aEnd);
> 370
> 371 for(; aStart != aEnd; ++aStart)
> 372 {
> 373 if(!aStart->equalZero())
> 374 mnUsedEntries++;
> 375 }
> 376 }
> 377 }
>
> Isn't aEnd iterator invalidated by insert call?
>
> There are others in this file but again, I'm not sure, I'm just wondering.
>
> Julien
>
>
>
> --
> View this message in context:
> http://nabble.documentfoundation.org/About-b3dpolygon-cxx-basegfx-tp4047270.html
> Sent from the Dev mailing list archive at Nabble.com.
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130401/b97c7d5c/attachment.html>
More information about the LibreOffice
mailing list