]> git.tdb.fi Git - ttf2png.git/commitdiff
Enable compiler optimizations and fix some warnings
authorMikko Rasa <tdb@tdb.fi>
Fri, 23 Nov 2012 21:40:50 +0000 (23:40 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 23 Nov 2012 21:46:24 +0000 (23:46 +0200)
Makefile
ttf2png.c

index 0bc7aad4364163f75f15b4b6ee627644d939fe10..cfe0ee0725fce1054130099129fd31d52c5f04f0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 ttf2png: ttf2png.c
-       gcc -Wall -Wextra -Werror -std=c89 -pedantic $^ -o $@ $(shell freetype-config --cflags --libs) $(shell pkg-config --cflags --libs libpng12)
+       gcc -Wall -Wextra -Werror -std=c89 -pedantic -O2 $^ -o $@ $(shell freetype-config --cflags --libs) $(shell pkg-config --cflags --libs libpng12)
 
 VER=0.3
 
index e25434945e41fa44d906ebfd1c5babc431b791a3..9714ecd24a32ee95b99f009a6ea29d7d2cb9d38a 100644 (file)
--- a/ttf2png.c
+++ b/ttf2png.c
@@ -320,14 +320,14 @@ void *alloc_image_data(size_t a, size_t b)
                        a += c;
                if(a<c)
                {
-                       fprintf(stderr, "Cannot allocate %d kbytes of memory for image\n", c/1024*b);
+                       fprintf(stderr, "Cannot allocate %lu kbytes of memory for image\n", (unsigned long)(c/1024*b));
                        return NULL;
                }
                b /= 2;
        }
        ptr = malloc(a);
        if(!ptr)
-               fprintf(stderr, "Cannot allocate %d kbytes of memory for image\n", a/1024*b);
+               fprintf(stderr, "Cannot allocate %lu kbytes of memory for image\n", (unsigned long)(a/1024*b));
        return ptr;
 }
 
@@ -727,7 +727,7 @@ int save_png(const char *fn, const Image *image, char alpha)
        png_info   *pngi;
        png_byte   **rows;
        unsigned   i;
-       png_byte   *data2;
+       png_byte   *data2 = 0;
        int        color;
 
        if(!strcmp(fn, "-"))