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.
Context
- About b3dpolygon.cxx (basegfx) · julien2412
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.