Date: Mon, 29 Mar 2010 13:49:59 +0300 From: Ion-Mihai Tetcu <itetcu@FreeBSD.org> To: Dominic Fandrey <kamikaze@bsdforen.de> Cc: Dirk Meyer <dinoex@FreeBSD.org>, cvs-ports@FreeBSD.org, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/graphics/imlib2 Makefile ports/graphics/imlib2/files patch-loader_png.c Message-ID: <20100329134959.18bf2919@it.buh.tecnik93.com> In-Reply-To: <4BB07D0F.4090604@bsdforen.de> References: <201003290931.o2T9VrXu030819@repoman.freebsd.org> <4BB07D0F.4090604@bsdforen.de>
next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/_M=DFoqn0w0USnPIof8+8i+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 29 Mar 2010 12:12:31 +0200 Dominic Fandrey <kamikaze@bsdforen.de> wrote: > On 29/03/2010 11:31, Dirk Meyer wrote: > > dinoex 2010-03-29 09:31:53 UTC > >=20 > > FreeBSD ports repository > >=20 > > Modified files: > > graphics/imlib2 Makefile=20 > > graphics/imlib2/files patch-loader_png.c=20 > > Log: > > - fix code for png-1.4.1 > > =20 > > Revision Changes Path > > 1.136 +1 -1 ports/graphics/imlib2/Makefile > > 1.3 +1 -1 ports/graphics/imlib2/files/patch-loader_png.c >=20 > Why did you rebreak imlib2? >=20 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 =3D fopen(file_name, "rb"); if (!fp) { return (ERROR); } fread(header, 1, number, fp); is_png =3D !png_sig_cmp(header, 0, number); if (!is_png) { return (NOT_PNG); } --=20 IOnut - Un^d^dregistered ;) FreeBSD "user" "Intellectual Property" is nowhere near as valuable as "Intellect" FreeBSD committer -> itetcu@FreeBSD.org, PGP Key ID 057E9F8B493A297B --Sig_/_M=DFoqn0w0USnPIof8+8i+ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkuwhdcACgkQJ7GIuiH/oeWJjwCfbXRRqNOEXRcyn7xsgFp15jXT cQEAnjqj7klQmmEZ18lqsASvEwdj37DT =4vJP -----END PGP SIGNATURE----- --Sig_/_M=DFoqn0w0USnPIof8+8i+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100329134959.18bf2919>