--- ray/src/px/ra_avs.c 1993/10/27 09:37:37 2.5 +++ ray/src/px/ra_avs.c 2003/06/05 19:29:34 2.10 @@ -1,23 +1,18 @@ -/* Copyright (c) 1993 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ra_avs.c,v 2.10 2003/06/05 19:29:34 schorsch Exp $"; #endif - /* * Convert Radiance file to/from AVS file. */ #include #include -#ifdef MSDOS -#include -#endif +#include + +#include "platform.h" #include "color.h" #include "resolu.h" -extern char *malloc(); - double gamcor = 2.2; /* gamma correction */ int bradj = 0; /* brightness adjustment */ @@ -65,20 +60,21 @@ char *argv[]; exit(1); } if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) { - fprintf(stderr, "can't open output \"%s\"\n", + fprintf(stderr, "%s: can't open output \"%s\"\n", progname, argv[i+1]); exit(1); } -#ifdef MSDOS - setmode(fileno(stdin), O_BINARY); - setmode(fileno(stdout), O_BINARY); -#endif + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); setcolrgam(gamcor); /* set up gamma correction */ if (reverse) { /* get their image resolution */ xmax = getint(4, stdin); ymax = getint(4, stdin); + if (feof(stdin)) + quiterr("empty input file"); /* put our header */ + newheader("RADIANCE", stdout); printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); @@ -143,7 +139,7 @@ avs2ra() /* convert 24-bit scanlines to Radiance pict quiterr("error writing Radiance picture"); } /* free scanline */ - free((char *)scanout); + free((void *)scanout); } @@ -173,5 +169,5 @@ ra2avs() /* convert Radiance scanlines to 24-bit */ quiterr("error writing AVS file"); } /* free scanline */ - free((char *)scanin); + free((void *)scanin); }