<p dir="ltr">You're right on both cases...</p>
<div class="gmail_quote">Em 01/04/2013 08:53, "julien2412" <<a href="mailto:serval2412@yahoo.fr">serval2412@yahoo.fr</a>> escreveu:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
There are a lot of iterators stuff in<br>
core/basegfx/source/polygon/b3dpolygon.cxx, I tried to fix 'prefix ++/--<br>
operators for non-primitive types' errors (provided by cppcheck) but I saw<br>
several iterator things I'm not sure, eg:<br>
    274     BColorArray(const BColorArray& rOriginal, sal_uInt32 nIndex,<br>
sal_uInt32 nCount)<br>
    275     :   maVector(),<br>
    276         mnUsedEntries(0L)<br>
    277     {<br>
    278         BColorDataVector::const_iterator<br>
aStart(rOriginal.maVector.begin());<br>
    279         aStart += nIndex;<br>
    280         BColorDataVector::const_iterator aEnd(aStart);<br>
    281         aEnd += nCount;<br>
    282         maVector.reserve(nCount);<br>
    283<br>
    284         for(; aStart != aEnd; ++aStart)<br>
    285         {<br>
    286             if(!aStart->equalZero())<br>
    287                 mnUsedEntries++;<br>
    288<br>
    289             maVector.push_back(*aStart);<br>
    290         }<br>
    291     }<br>
Isn't aEnd invalidated by push_back call?<br>
Isn't aEnd += nCount dangerous? (if aEnd tries to go further than<br>
rOriginal.maVector.end())<br>
<br>
    358     void insert(sal_uInt32 nIndex, const BColorArray& rSource)<br>
    359     {<br>
    360         const sal_uInt32 nCount(rSource.maVector.size());<br>
    361<br>
    362         if(nCount)<br>
    363         {<br>
    364             // insert data<br>
    365             BColorDataVector::iterator aIndex(maVector.begin());<br>
    366             aIndex += nIndex;<br>
    367             BColorDataVector::const_iterator<br>
aStart(rSource.maVector.begin());<br>
    368             BColorDataVector::const_iterator<br>
aEnd(rSource.maVector.end());<br>
    369             maVector.insert(aIndex, aStart, aEnd);<br>
    370<br>
    371             for(; aStart != aEnd; ++aStart)<br>
    372             {<br>
    373                 if(!aStart->equalZero())<br>
    374                     mnUsedEntries++;<br>
    375             }<br>
    376         }<br>
    377     }<br>
<br>
Isn't aEnd iterator invalidated by insert call?<br>
<br>
There are others in this file but again, I'm not sure, I'm just wondering.<br>
<br>
Julien<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://nabble.documentfoundation.org/About-b3dpolygon-cxx-basegfx-tp4047270.html" target="_blank">http://nabble.documentfoundation.org/About-b3dpolygon-cxx-basegfx-tp4047270.html</a><br>

Sent from the Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
LibreOffice mailing list<br>
<a href="mailto:LibreOffice@lists.freedesktop.org">LibreOffice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/libreoffice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libreoffice</a><br>
</blockquote></div>