[PUSHED] Re: [PATCH] More SV_DECL_PTRARR conversions (19)

Michael Stahl mstahl at redhat.com
Tue Jul 17 06:47:01 PDT 2012


On 13/07/12 16:39, Noel Grandin wrote:
> Hi
> 
> This patch series continues the journey of converting SV_DECL_PTRARR to 
> modern STL containers.

thanks, pushed to master

patch #2 had this, which is undefined behaviour because the order in
which the parameters of the != expression is evaluated is undefined, so
it could happen that end() is evaluated first which would be wrong:

> -        if (pParent->pData->GetSeqNo() && !aUsedSeqNo.Insert(pParent, nPos))    // already there
> +        if ( pParent->pData->GetSeqNo() && (it = aUsedSeqNo.insert(pParent).first) != aUsedSeqNo.end() )    // already there

patch #13 removed a "delete", introducing a memory leak; it would be
ideal to use std::auto_ptr::release() here but unfortunately somebody
decided to deprecate that, so back to the delete...

patch #19 was missing some end() checks before incrementing iterators

> Also included are updates to o3tl::sorted_vector based on comments from 
> David Tardon.

furthermore i've done some tweaks to the sorted_vector, to fix a very
mysterious error from GCC 4.7 which claimed that vector is not a
template (?), and also removed the by-value non-const operator[] which
doesn't make much sense to me or the people on IRC that i asked.



More information about the LibreOffice mailing list