[Libreoffice] how to handle this bug (if this is one?)

Eike Rathke ooo at erack.de
Sat Aug 27 14:30:44 PDT 2011


Hi Pierre-André,

On Friday, 2011-08-26 23:19:34 +0200, Pierre-André Jacquod wrote:

> in vcl/win/source/gdi/winlayout.cxx, around line 695 there is:
> 
>  long SimpleWinLayout::FillDXArray( long* pDXArray ) const
>  {
> +    if( !mnWidth )
> +    {
> +        long mnWidth = mnBaseAdv;
> +        for( int i = 0; i < mnGlyphCount; ++i )
> +            mnWidth += mpGlyphAdvances[ i ];
> +    }
> 
> +    if( pDXArray != NULL )
>      {
> +        for( int i = 0; i < mnCharCount; ++i )
> +             pDXArray[ i ] = mpCharWidths[ i ];
>      }
> 
> +    return mnWidth;
>  }
> 
> the statement within th IF does not make any sense for my poor
> understanding. As I read the code, the first IF could also be
> totally removed, since as soon as exiting the first IF, all value
> are lost.

Looks like a leftover from the previous version where nWidth was
calculated only locally without the result ever being assigned to
mnWidth and the local nWidth being returned. With the change that logic
changed, the mnWidth member variable still not being assigned a value
but returning mnWidth. I guess the correct approach would be to remove
the local long declaration so that it reads

    if( !mnWidth )
    {
        mnWidth = mnBaseAdv;
        for( int i = 0; i < mnGlyphCount; ++i )
            mnWidth += mpGlyphAdvances[ i ];
    }


  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110827/cdca3023/attachment.pgp>


More information about the LibreOffice mailing list