--- ray/src/px/ra_hexbit.c 1998/07/08 18:01:00 3.1 +++ ray/src/px/ra_hexbit.c 2019/12/28 18:05:14 3.6 @@ -1,34 +1,32 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: ra_hexbit.c,v 3.6 2019/12/28 18:05:14 greg Exp $"; #endif - /* * Create a 4x1 hex bitmap from a Radiance picture. */ -#include +#include "platform.h" #include "color.h" +#include "rtio.h" #include "resolu.h" -extern char *malloc(); - char *progname; - int xmax, ymax; - double thresh = 0.5; /* threshold value */ - COLR threshclr; #define abovethresh(c) ((c)[EXP]>threshclr[EXP] || \ ((c)[EXP]==threshclr[EXP] && (c)[GRN]>threshclr[GRN])) +static void quiterr(char *err); +static void ra2hex(void); -main(argc, argv) -int argc; -char *argv[]; + +int +main( + int argc, + char *argv[] +) { int i; @@ -60,6 +58,8 @@ char *argv[]; } /* assign threshold color */ setcolr(threshclr, thresh, thresh, thresh); + /* binary input */ + SET_FILE_BINARY(stdin); /* get our header */ if (checkheader(stdin, COLRFMT, NULL) < 0 || fgetresolu(&xmax, &ymax, stdin) < 0) @@ -74,8 +74,10 @@ userr: } -quiterr(err) /* print message and exit */ -char *err; +static void +quiterr( /* print message and exit */ + char *err +) { if (err != NULL) { fprintf(stderr, "%s: %s\n", progname, err); @@ -85,7 +87,8 @@ char *err; } -ra2hex() /* convert Radiance scanlines to 4x1 bit hex */ +static void +ra2hex(void) /* convert Radiance scanlines to 4x1 bit hex */ { static char cmap[] = "0123456789ABCDEF"; COLR *scanin; @@ -115,5 +118,5 @@ ra2hex() /* convert Radiance scanlines to 4x1 bit hex quiterr("error writing hex bit file"); } /* free scanline */ - free((char *)scanin); + free((void *)scanin); }