]> git.imager.perl.org - imager.git/commitdiff
PNG re-work: remove obsolete comment and the associated unused code
authorTony Cook <tony@develop-help.com>
Mon, 2 Apr 2012 11:53:16 +0000 (21:53 +1000)
committerTony Cook <tony@develop-help.com>
Sun, 29 Apr 2012 03:40:55 +0000 (13:40 +1000)
This appears to have been copied from libpng's example.c

PNG/impng.c

index 2eb60d3e2f9b5aef4ae43dfa55bfa8eabbf5032d..3311e6266c035e285c6183796a27e2d14db15f8b 100644 (file)
@@ -1,27 +1,6 @@
 #include "impng.h"
 #include "png.h"
 
-/* Check to see if a file is a PNG file using png_sig_cmp().  png_sig_cmp()
- * returns zero if the image is a PNG and nonzero if it isn't a PNG.
- *
- * The function check_if_png() shown here, but not used, returns nonzero (true)
- * if the file can be opened and is a PNG, 0 (false) otherwise.
- *
- * If this call is successful, and you are going to keep the file open,
- * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once
- * you have created the png_ptr, so that libpng knows your application
- * has read that many bytes from the start of the file.  Make sure you
- * don't call png_set_sig_bytes() with more than 8 bytes read or give it
- * an incorrect number of bytes read, or you will either have read too
- * many bytes (your fault), or you are telling libpng to read the wrong
- * number of magic bytes (also your fault).
- *
- * Many applications already read the first 2 or 4 bytes from the start
- * of the image to determine the file type, so it would be easiest just
- * to pass the bytes to png_sig_cmp() or even skip that if you know
- * you have a PNG file, and call png_set_sig_bytes().
- */
-
 /* this is a way to get number of channels from color space 
  * Color code to channel number */
 
@@ -57,18 +36,6 @@ wiol_flush_data(png_structp png_ptr) {
   /* XXX : This needs to be added to the io layer */
 }
 
-
-/* Check function demo 
-
-int
-check_if_png(char *file_name, FILE **fp) {
-  char buf[PNG_BYTES_TO_CHECK];
-  if ((*fp = fopen(file_name, "rb")) != NULL) return 0;
-  if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) return 0;
-  return(!png_sig_cmp((png_bytep)buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
-}
-*/
-
 static void
 error_handler(png_structp png_ptr, png_const_charp msg) {
   mm_log((1, "PNG error: '%s'\n", msg));