aboutsummaryrefslogtreecommitdiff
path: root/gentpl
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2009-02-21 18:16:34 -0500
committercomex <comexk@gmail.com>2009-02-21 18:16:34 -0500
commit39b0f93fb71d415c5061ec46f8bf79e049ede5f1 (patch)
treee2cfbe474539a6513f1d5b2e8b92c08c8f9d6ee7 /gentpl
parent39baa1446e6b5ffbc83b61755297d9687111e807 (diff)
gentpl - move error
Diffstat (limited to '')
-rw-r--r--gentpl/gentpl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gentpl/gentpl.c b/gentpl/gentpl.c
index 9a55f13..35b8a35 100644
--- a/gentpl/gentpl.c
+++ b/gentpl/gentpl.c
@@ -31,17 +31,18 @@ int main(int argc, char **argv) {
}
im = gdImageCreateFromPng(in);
fclose(in);
- FILE *out = fopen(argv[2], "wb");
- if(!out) {
- printf("Failed to open %s\n", argv[2]); // why strerror not working?
- exit(1);
- }
if(gdImageSX(im) % 4 != 0 || gdImageSY(im) % 4 != 0) {
printf("Bad dimensions\n");
exit(1);
}
+ FILE *out = fopen(argv[2], "wb");
+ if(!out) {
+ printf("Failed to open %s\n", argv[2]); // why strerror not working?
+ exit(1);
+ }
+
char magic[] = {0x00, 0x20, 0xaf, 0x30};
fwrite(magic, 1, 4, out);
@@ -87,4 +88,4 @@ int main(int argc, char **argv) {
fclose(out);
gdImageDestroy(im);
-} \ No newline at end of file
+}