[PATCH] More STL'ification (7)

Michael Stahl mstahl at redhat.com
Mon Aug 13 13:53:40 PDT 2012


On 13/08/12 15:37, Noel Grandin wrote:
> Hi
> 
> These patches convert various places from using tools/list.hxx to using 
> normal STL containers.

thanks, pushed to master.

patch #2 had some problems; nIdx becomes n here:
(ridiculous indentation by original code author)

> -                                                                    aCharPropList.Insert( pNewCPS, nIdx + 1 );
> +                                                                    aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );

n++ missing:

> -                                                            aCharPropList.Insert( pBefCPS, n++ );
> +                                                            aCharPropList.insert( aCharPropList.begin() + n, pBefCPS );

this is broken because the same nCurPos is used for both the paragraph
properties and the character properties, while actually a single
paragraph may have multiple character properties/text portions, so it's
necessary to have 2 independent iterators.

> -PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPTStyleSheet& rStyleSheet,
> +PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, sal_uInt32 nCurPos, const PPTStyleSheet& rStyleSheet,
>                                      sal_uInt32 nInstance, PPTTextRulerInterpreter& rRuler ) :
> -    PPTParaPropSet          ( *( (PPTParaPropSet*)rPropReader.aParaPropList.GetCurObject() ) ),
> +    PPTParaPropSet          ( *rPropReader.aParaPropList[nCurPos] ),
>      PPTNumberFormatCreator  ( NULL ),
>      PPTTextRulerInterpreter ( rRuler ),
>      mrStyleSheet            ( rStyleSheet ),
> @@ -5645,18 +5643,18 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPT
>      mnPortionCount          ( 0 ),
>      mpPortionList           ( NULL )
>  {
> -    sal_uInt32 nCurPos = rPropReader.aCharPropList.GetCurPos();
> -    PPTCharPropSet* pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.GetCurObject();
> +    PPTCharPropSet* pCharPropSet = rPropReader.aCharPropList[nCurPos];
>      if ( pCharPropSet )
>      {
>          sal_uInt32 nCurrentParagraph = pCharPropSet->mnParagraph;
> -        for ( ; pCharPropSet && ( pCharPropSet->mnParagraph == nCurrentParagraph ); pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next() )
> +        for ( sal_uInt32 n = nCurPos;
> +              n < rPropReader.aCharPropList.size() && rPropReader.aCharPropList[n]->mnParagraph == nCurrentParagraph; ++n )




More information about the LibreOffice mailing list