[PATCH 1/2] Implement GdipGetLogFontA (try2)

Dmitry Timoshkov dmitry at codeweavers.com
Sun Nov 9 21:00:57 CST 2008


"Adam Petaccia" <adam at tpetaccia.com> wrote:

> +GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
> +    LOGFONTA *lfa)
> +{
> +    INT bytesWritten;
> +    /* FIXME: use graphics */
> +    if(!(font && graphics && lfa))
> +        return InvalidParameter;
> +
> +    memcpy(lfa, &font->lfw, sizeof(LOGFONTA));

FIELD_OFFSET(LOGFONTA, lfFaceName) instead of sizeof(LOGFONTA) would be better IMO.

> +    bytesWritten = WideCharToMultiByte(CP_ACP, 0, font->lfw.lfFaceName, -1,
> +            lfa->lfFaceName, LF_FACESIZE, NULL, NULL);
> +
> +    if (bytesWritten == 0)
> +    {
> +        ERR("Could not convert from WideChar to Multibyte with error %d\n",
> +                GetLastError());
> +        return GenericError;
> +    }

The ERR() as well as the bytesWritten check are useless, please remove them.

-- 
Dmitry.



More information about the wine-devel mailing list