--- ray/src/px/macbethcal.c 2003/02/22 02:07:27 2.17 +++ ray/src/px/macbethcal.c 2003/10/27 10:24:51 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: macbethcal.c,v 2.17 2003/02/22 02:07:27 greg Exp $"; +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 @@ -12,10 +12,10 @@ static const char RCSid[] = "$Id: macbethcal.c,v 2.17 #include #include -#ifdef MSDOS -#include -#endif -#include +#include + +#include "platform.h" +#include "rtprocess.h" #include "color.h" #include "resolu.h" #include "pmap.h" @@ -141,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; @@ -188,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); @@ -246,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, @@ -370,11 +367,11 @@ getcolors() /* get xyY colors from standard input */ float xyYin[3]; while (fgetval(stdin, 'i', &n) == 1) { /* read colors */ - if (n < 0 | n > 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);