--- ray/src/px/macbethcal.c 1999/07/16 16:12:20 2.16 +++ ray/src/px/macbethcal.c 2003/10/27 10:24:51 2.21 @@ -1,9 +1,6 @@ -/* Copyright (c) 1999 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: macbethcal.c,v 2.21 2003/10/27 10:24:51 schorsch Exp $"; #endif - /* * Calibrate a scanned MacBeth Color Checker Chart * @@ -15,9 +12,10 @@ static char SCCSid[] = "$SunId$ SGI"; #include #include -#ifdef MSDOS -#include -#endif +#include + +#include "platform.h" +#include "rtprocess.h" #include "color.h" #include "resolu.h" #include "pmap.h" @@ -125,9 +123,7 @@ WARP3D *wcor = NULL; /* color space warp */ FILE *debugfp = NULL; /* debug output picture */ char *progname; -extern char *malloc(); - main(argc, argv) int argc; char **argv; @@ -145,9 +141,7 @@ char **argv; perror(argv[i]); exit(1); } -#ifdef MSDOS - setmode(fileno(debugfp), O_BINARY); -#endif + SET_FILE_BINARY(debugfp); newheader("RADIANCE", debugfp); /* start */ printargs(argc, argv, debugfp); /* header */ break; @@ -192,9 +186,7 @@ char **argv; exit(1); } if (scanning) { /* load input picture header */ -#ifdef MSDOS - setmode(fileno(stdin), O_BINARY); -#endif + SET_FILE_BINARY(stdin); if (checkheader(stdin, COLRFMT, NULL) < 0 || fgetresolu(&xmax, &ymax, stdin) < 0) { fprintf(stderr, "%s: bad input picture\n", progname); @@ -250,11 +242,12 @@ char **argv; printf("}\n"); putmapping(); /* put out color mapping */ } - if (debugfp != NULL) /* put out debug picture */ + if (debugfp != NULL) { /* put out debug picture */ if (scanning) picdebug(); else clrdebug(); + } exit(0); userr: fprintf(stderr, @@ -362,7 +355,7 @@ getpicture() /* load in picture colors */ scalecolor(inpRGB[i], d); inpflags |= 1L< 24 || + if ((n < 0) | (n > 24) || fgetval(stdin, 'f', &xyYin[0]) != 1 || fgetval(stdin, 'f', &xyYin[1]) != 1 || fgetval(stdin, 'f', &xyYin[2]) != 1 || - xyYin[0] < 0. | xyYin[1] < 0. || + (xyYin[0] < 0.) | (xyYin[1] < 0.) || xyYin[0] + xyYin[1] > 1.) { fprintf(stderr, "%s: bad color input data\n", progname); @@ -712,7 +705,7 @@ picdebug() /* put out debugging picture */ } /* clean up */ fclose(debugfp); - free((char *)scan); + free((void *)scan); } @@ -782,7 +775,7 @@ clrdebug() /* put out debug picture from color input } /* clean up */ fclose(debugfp); - free((char *)scan); + free((void *)scan); }