Hi,

I found a strange code in sw/source/core/txtnode/fntcache.cxx.
The line #787 is causing warning "comparison is always false due to limited 
range 
of data type" in mingw build.

It is in WNT only #if block and causes no warning in MSVC build.

I suspect that the comparison is wrong but I am not sure. Should I raise an 
issue?

...

void SwFntObj::GuessLeading( const ViewShell&
#if defined(WNT) || defined(WIN) || defined(PM2)
                             rSh
#endif
                             , const FontMetric& rMet )
{
    // If leading >= 5, this seems to be enough leading.
    // Nothing has to be done.
    if ( rMet.GetIntLeading() >= 5 )
    {
        nGuessedLeading = 0;
        return;
    }

#if defined(WNT) || defined(WIN) || defined(PM2)
    OutputDevice *pWin = rSh.GetWin() ?
                         rSh.GetWin() :
                         GetpApp()->GetDefaultDevice();
        if ( pWin )
        {
                MapMode aTmpMap( MAP_TWIP );
                MapMode aOldMap = pWin->GetMapMode( );
                pWin->SetMapMode( aTmpMap );
                const Font aOldFnt( pWin->GetFont() );
                pWin->SetFont( *pPrtFont );
                const FontMetric aWinMet( pWin->GetFontMetric() );
                const USHORT nWinHeight = USHORT( aWinMet.GetSize().Height() );
                if( pPrtFont->GetName().Search( aWinMet.GetName() ) < USHRT_MAX 
)
                {
                        // Wenn das Leading auf dem Window auch 0 ist, dann
                        // muss es auch so bleiben (vgl. StarMath!).
            long nTmpLeading = (long)aWinMet.GetIntLeading();
                         // einen Versuch haben wir noch wg. 31003:
                        if( nTmpLeading <= 0 )
                        {
                                pWin->SetFont( rMet );
                nTmpLeading = (long)pWin->GetFontMetric().GetIntLeading();
                                if( nTmpLeading < 0 )
                    nGuessedLeading = 0;
                                else
                    nGuessedLeading = USHORT(nTmpLeading);
                        }
                        else
                        {
                nGuessedLeading = USHORT(nTmpLeading);
                                // Manta-Hack #50153#:
                                // Wer beim Leading luegt, luegt 
moeglicherweise 
auch beim
                                // Ascent/Descent, deshalb wird hier ggf. der 
Font 
ein wenig
                                // tiefergelegt, ohne dabei seine Hoehe zu 
aendern.
                                long nDiff = Min( rMet.GetDescent() - 
aWinMet.GetDescent(),
                                        aWinMet.GetAscent() - rMet.GetAscent() 
- 
nTmpLeading );
                                if( nDiff > 0 )
                                {
                                        ASSERT( nPrtAscent < USHRT_MAX, 
"GuessLeading: PrtAscent-Fault" );
                    if ( USHRT_MAX < nPrtAscent )                       <--Here
                        nPrtAscent = nPrtAscent + (USHORT)(( 2 * nDiff ) / 5);
                                }
                        }
                }
                else
                {
                        // Wenn alle Stricke reissen, nehmen wir 15% der
                        // Hoehe, ein von CL empirisch ermittelter Wert.
            nGuessedLeading = (nWinHeight * 15) / 100;b

                }
                pWin->SetFont( aOldFnt );
                pWin->SetMapMode( aOldMap );
        }
        else
#endif
        nGuessedLeading = 0;
}

----
 Takashi Ono(HK Freak)
 mailto:[EMAIL PROTECTED] or [EMAIL PROTECTED]
        (Personal Address, checked every morning/evening and holidays)
 mailto:[EMAIL PROTECTED]
        (Address for business, checked every working days)
 http://www.hkfreak.net

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to