X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=zic2xpm.c;h=842f03d2866c38ad7aae78df7d384f214f6ecc52;hb=e70077aab0199817f37aef9ed0bdba1bbca93b45;hp=d309e83a8aca5f0c82aafccc8268c99bc4d1d336;hpb=5cd55bddca592918f38deff675d05b650a71412e;p=xboard.git diff --git a/zic2xpm.c b/zic2xpm.c index d309e83..842f03d 100644 --- a/zic2xpm.c +++ b/zic2xpm.c @@ -4,7 +4,7 @@ Program to convert pieces from ZIICS format to XPM & XIM format. (C version) By Frank McIngvale . - Copyright (C) 1996, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1996, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. NOTICE: The piece images distributed with ZIICS are copyrighted works of their original creators. Images @@ -115,6 +115,7 @@ typedef struct { } z2xpm; #define NR_ZIICS_COLORS 4 +#define BUFLEN 100 /* SHOWSETS.PAS (from ZIICS) states that images may only use color numbers 0, 2, 14, and 15 */ @@ -441,7 +442,7 @@ int process_file_xim( filename ) int nr_pieces = 6; int nr_kinds = 4; FILE *fp; - char buf[100]; + char buf[BUFLEN]; src_name = filename; @@ -478,18 +479,18 @@ int process_file_xim( filename ) { printf( "." ); /* Form output filename -- .xim */ - sprintf(buf, "%c%s%d.xim", pieces[piece], prefixes[kind], w); + snprintf(buf, BUFLEN, "%c%s%d.xim", pieces[piece], prefixes[kind], w); create_piece_xim( buf, fp, w, h ); } printf("\n"); } /* Write the light & dark squares */ - sprintf( buf, "lsq%d.xim", w ); + snprintf( buf, BUFLEN, "lsq%d.xim", w ); printf("Light Square" ); create_piece_xim( buf, fp, w, h ); - sprintf( buf, "dsq%d.xim", w ); + snprintf( buf, BUFLEN, "dsq%d.xim", w ); printf("\nDark Square" ); create_piece_xim( buf, fp, w, h ); printf("\n"); @@ -508,7 +509,7 @@ int process_file_xpm( filename ) int nr_pieces = 6; int nr_kinds = 4; FILE *fp; - char buf[100]; + char buf[BUFLEN]; src_name = filename; @@ -545,18 +546,18 @@ int process_file_xpm( filename ) { printf( "." ); /* Form output filename -- .xpm */ - sprintf(buf, "%c%s%d.xpm", pieces[piece], prefixes[kind], w); + snprintf(buf, BUFLEN, "%c%s%d.xpm", pieces[piece], prefixes[kind], w); create_piece_xpm( buf, fp, w, h ); } printf("\n"); } /* Write the light & dark squares */ - sprintf( buf, "lsq%d.xpm", w ); + snprintf( buf, BUFLEN, "lsq%d.xpm", w ); printf("Light Square" ); create_piece_xpm( buf, fp, w, h ); - sprintf( buf, "dsq%d.xpm", w ); + snprintf( buf, BUFLEN, "dsq%d.xpm", w ); printf("\nDark Square" ); create_piece_xpm( buf, fp, w, h ); printf("\n");