Include alloca.h if available.
[m17n/libotf.git] / example / otftobdf.c
index 70f6a3a..b9488da 100644 (file)
@@ -26,6 +26,11 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#include "config.h"
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
 #define DEFAULT_PIXEL_SIZE 16
 
 FT_Face face;
@@ -77,7 +82,7 @@ dump_image (int pixel_size, int index, int code, int full)
   unsigned char *buf;
   FT_GlyphSlot glyph;
   int dwidth, x, y;
-  
+
   if (err)
     return;
   glyph = face->glyph;
@@ -124,7 +129,7 @@ main (int argc, char **argv)
   char *filename;
   int platform_id, encoding_id;
 
-  if (argc < 1)
+  if (argc <= 1)
     FATAL_ERROR ("Usage: %s ENCODING OTF-FILE\n", argv[0]);
   if (sscanf (argv[1], "%d-%d", &platform_id, &encoding_id) != 2)
     {
@@ -133,7 +138,7 @@ main (int argc, char **argv)
     }
   else
     filename = argv[2];
-  
+
   if ((err = FT_Init_FreeType (&library)))
     FATAL_ERROR ("%s\n", "FT_Init_FreeType: error");
   err = FT_New_Face (library, filename, 0, &face);
@@ -217,7 +222,7 @@ main (int argc, char **argv)
   dump_header (face, "unknown", nchars, pixel_size);
   for (i = 0; i < 0x10000; i++)
     if (code_table[i] >= 0)
-      dump_image (pixel_size, code_table[i], i, 1);
+      dump_image (pixel_size, code_table[i], i, 0);
   dump_tailer ();
 
   exit (0);