2009/1/27 Kai Blin <kai.b...@gmail.com>:
>
> lcdfilter = FT_LCD_FILTER_DEFAULT is hardcoded, so the check is always true.
>
> This fixes Coverity CID 816
>
> diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
> index 1ca6953..dfbcf2f 100644
> --- a/dlls/gdi32/freetype.c
> +++ b/dlls/gdi32/freetype.c
> @@ -4783,18 +4783,15 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, 
> UINT glyph, UINT format,
>                  (format == WINE_GGO_HRGB_BITMAP || format == 
> WINE_GGO_HBGR_BITMAP)?
>                      FT_RENDER_MODE_LCD: FT_RENDER_MODE_LCD_V;
>
> -            if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == 
> FT_LCD_FILTER_LIGHT )
> +            if ( render_mode == FT_RENDER_MODE_LCD)
>              {
> -                if ( render_mode == FT_RENDER_MODE_LCD)
> -                {
> -                    lpgm->gmBlackBoxX += 2;
> -                    lpgm->gmptGlyphOrigin.x -= 1;
> -                }
> -                else
> -                {
> -                    lpgm->gmBlackBoxY += 2;
> -                    lpgm->gmptGlyphOrigin.y += 1;
> -                }
> +                lpgm->gmBlackBoxX += 2;
> +                lpgm->gmptGlyphOrigin.x -= 1;
> +            }
> +            else
> +            {
> +                lpgm->gmBlackBoxY += 2;
> +                lpgm->gmptGlyphOrigin.y += 1;
>              }
>
>              width  = lpgm->gmBlackBoxX;

It doesn't make much sense to leave the lcdfilter variable in the
function if you're going to remove the if condition depending on it,
since it only has one other use.
However, It might have been the intention of the author of this code
that this is setting to be changed at compile time (or runtime through
a registry tweak) and have the code do the appropriate thing - in that
case it would have been better to put the variable at the top of the
file.

-- 
Rob Shearman


Reply via email to