[PUSHED] Re: [PATCH] Converting Svptrarr usage (33)

Michael Stahl mstahl at redhat.com
Mon Jun 25 13:50:58 PDT 2012


On 25/06/12 14:29, Noel Grandin wrote:
> These patches convert various usage of Svptrarr to modern STL containers 
> like std::vector.
> Along the way, I noticed some other stuff, so one of the patches deletes 
> a dead header file, and one of them cleans up a const-casting mess.
> 
> This patch series passes make check, and has been compiled with 
> --enable-dbgutil.

great, didn't have any build problems :)

pushed to master, thanks.

patches #1 and #14 have one of the dreaded vector(size_t)

> +            std::vector<DateTime*> aDateTimeArr( 16 );

patch #17 has a subtle issue:

> -    sal_uInt16 nPos = SvPtrarr::GetPos( pObj );
> -    if( nPos )
> +    iterator it = std::find( begin(), end(), pObj );
> +    if( it != begin() )
>      {
>          // object is currently not the first in cache
> -        if( USHRT_MAX != nPos )
> -            SvPtrarr::Remove( nPos );
> +        if( it != end() )
> +            erase( it );

it != begin() will be false for empty container, because then it ==
end() and begin() == end() hence end() != end() is false; while before
nPos is USHRT_MAX for empty container, which is true here.

ah, and this bit here seems to be C++11 syntax that at least Apple GCC
doesn't understand:

> -        pArr->push_back( { pBoxFrmFmt, pNewTableBoxFmt } );



More information about the LibreOffice mailing list