gd2_read.c (libgd-2.2.4) | : | gd2_read.c (libgd-2.2.5) | ||
---|---|---|---|---|
#include "gd.h" | #include "gd.h" | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include "gdtest.h" | #include "gdtest.h" | |||
int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | |||
{ | { | |||
int error, i = 0; | int error = 0, i = 0; | |||
gdImagePtr im, exp; | gdImagePtr im, exp; | |||
FILE *fp; | FILE *fp; | |||
char *path[] = { | char *path[] = { | |||
"conv_test.gd2", | "conv_test.gd2", | |||
"invalid_neg_size.gd2", | "invalid_neg_size.gd2", | |||
"invalid_header.gd2", | "invalid_header.gd2", | |||
NULL | NULL | |||
}; | }; | |||
char *path_exp[] = { | char *path_exp[] = { | |||
"conv_test_exp.png", | "conv_test_exp.png", | |||
skipping to change at line 43 | skipping to change at line 43 | |||
fp = gdTestFileOpen2("gd2", path_exp[i]); | fp = gdTestFileOpen2("gd2", path_exp[i]); | |||
if (!fp) { | if (!fp) { | |||
gdTestErrorMsg("failed, cannot open file: %s\n", path_exp[i]); | gdTestErrorMsg("failed, cannot open file: %s\n", path_exp[i]); | |||
return 1; | return 1; | |||
} | } | |||
exp = gdImageCreateFromPng(fp); | exp = gdImageCreateFromPng(fp); | |||
if (!gdAssertImageEquals(exp, im)) { | if (!gdAssertImageEquals(exp, im)) { | |||
gdTestErrorMsg("image %s differs from expected re sult\n", path[i]); | gdTestErrorMsg("image %s differs from expected re sult\n", path[i]); | |||
gdImageDestroy(im); | gdImageDestroy(im); | |||
error = 1; | error = 1; | |||
} else { | ||||
error = 0; | ||||
} | } | |||
if (exp) { | if (exp) { | |||
gdImageDestroy(exp); | gdImageDestroy(exp); | |||
} | } | |||
} else { | } else { | |||
/* expected to fail */ | /* expected to fail */ | |||
if (im) { | if (im) { | |||
gdTestErrorMsg("image %s should have failed to be loaded\n", path[i]); | gdTestErrorMsg("image %s should have failed to be loaded\n", path[i]); | |||
gdImageDestroy(im); | gdImageDestroy(im); | |||
error = 1; | error = 1; | |||
} else { | ||||
error = 0; | ||||
} | } | |||
} | } | |||
i++; | i++; | |||
} | } | |||
return error; | return error; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 1 lines changed or added |