[3/5] gdi32: Add the ability to load a scalable font resource. Take 3.

Alexandre Julliard julliard at winehq.org
Thu Nov 18 07:51:15 CST 2010


Dmitry Timoshkov <dmitry at codeweavers.com> writes:

> +    if (!ReadFile(hfile, &dos, sizeof(dos), NULL, NULL))
> +        goto errexit;
> +
> +    if (dos.e_magic != IMAGE_DOS_SIGNATURE)
> +        goto errexit;
> +
> +    if (SetFilePointer(hfile, dos.e_lfanew, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
> +        goto errexit;
> +
> +    if (!ReadFile(hfile, &os2, sizeof(os2), NULL, NULL))
> +        goto errexit;

Again that's inefficient, you don't want to read it bit by bit. You
should read the whole file in one go, or use a memory mapping. If using
ReadFile you also have to check the returned size.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list