On Mon, 29 Mar 2010 12:12:31 +0200
Dominic Fandrey <[email protected]> wrote:

> On 29/03/2010 11:31, Dirk Meyer wrote:
> > dinoex      2010-03-29 09:31:53 UTC
> > 
> >   FreeBSD ports repository
> > 
> >   Modified files:
> >     graphics/imlib2      Makefile 
> >     graphics/imlib2/files patch-loader_png.c 
> >   Log:
> >   - fix code for png-1.4.1
> >   
> >   Revision  Changes    Path
> >   1.136     +1 -1      ports/graphics/imlib2/Makefile
> >   1.3       +1 -1      ports/graphics/imlib2/files/patch-loader_png.c
> 
> Why did you rebreak imlib2?
> 

Trouble is this is the correct code, according to png developers:

libpng-1.4.1/CHANGES:  Changed png_check_sig() to !png_sig_cmp() in contrib 
programs.

Libpng provides a simple check to see if a file is a PNG file.
To use it, pass in the first 1 to 8 bytes of the file to the function
png_sig_cmp(), and it will return 0 (false) if the bytes match the
corresponding bytes of the PNG signature, or nonzero (true) otherwise.
Of course, the more bytes you pass in, the greater the accuracy of the
prediction.


    FILE *fp = fopen(file_name, "rb");
    if (!fp)
    {
        return (ERROR);
    }
    fread(header, 1, number, fp);
    is_png = !png_sig_cmp(header, 0, number);
    if (!is_png)
    {
        return (NOT_PNG);
    }


-- 
IOnut - Un^d^dregistered ;) FreeBSD "user"
  "Intellectual Property" is   nowhere near as valuable   as "Intellect"
FreeBSD committer -> [email protected], PGP Key ID 057E9F8B493A297B

Attachment: signature.asc
Description: PGP signature

Reply via email to