diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/tests/jpeg/jpeg_empty_file.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/tests/jpeg/jpeg_empty_file.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Build/source/libs/gd/libgd-src/tests/jpeg/jpeg_empty_file.c b/Build/source/libs/gd/libgd-src/tests/jpeg/jpeg_empty_file.c new file mode 100644 index 00000000000..844dbf43d3e --- /dev/null +++ b/Build/source/libs/gd/libgd-src/tests/jpeg/jpeg_empty_file.c @@ -0,0 +1,31 @@ +/* $Id$ */ +#include "gd.h" +#include <stdio.h> +#include <stdlib.h> +#include "gdtest.h" + +int main() +{ + gdImagePtr im; + FILE *fp; + char path[1024]; + + gdSetErrorMethod(gdSilence); + + sprintf(path, "%s/jpeg/empty.jpeg", GDTEST_TOP_DIR); + fp = fopen(path, "rb"); + if (!fp) { + printf("failed, cannot open file\n"); + return 1; + } + + im = gdImageCreateFromJpeg(fp); + fclose(fp); + + if (!im) { + return 0; + } else { + gdImageDestroy(im); + return 1; + } +} |