[libpng16] Fixed the simplified API example programs and improved the error

message if the version field is not set.
This commit is contained in:
John Bowler
2012-08-31 17:32:36 -05:00
committed by Glenn Randers-Pehrson
parent fd043e5d0d
commit ed3ca0e3eb
5 changed files with 47 additions and 6 deletions

View File

@@ -1357,6 +1357,10 @@ png_image_begin_read_from_stdio(png_imagep image, FILE* file)
"png_image_begin_read_from_stdio: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
"png_image_begin_read_from_stdio: incorrect PNG_IMAGE_VERSION");
return 0;
}
@@ -1391,6 +1395,10 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
"png_image_begin_read_from_file: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
"png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION");
return 0;
}
#endif /* PNG_STDIO_SUPPORTED */
@@ -1452,6 +1460,10 @@ int PNGAPI png_image_begin_read_from_memory(png_imagep image,
"png_image_begin_read_from_memory: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
"png_image_begin_read_from_memory: incorrect PNG_IMAGE_VERSION");
return 0;
}
@@ -3954,6 +3966,10 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
"png_image_finish_read: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
"png_image_finish_read: damaged PNG_IMAGE_VERSION");
return 0;
}