cvs commit: ports/graphics/imlib2 Makefile
ports/graphics/imlib2/files patch-loader_png.c
Ion-Mihai Tetcu
itetcu at FreeBSD.org
Mon Mar 29 10:50:03 UTC 2010
On Mon, 29 Mar 2010 12:12:31 +0200
Dominic Fandrey <kamikaze at bsdforen.de> 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 -> itetcu at FreeBSD.org, PGP Key ID 057E9F8B493A297B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-all/attachments/20100329/0d9a8833/signature.pgp
More information about the cvs-all
mailing list