--- ray/src/px/ra_ppm.c 2003/02/22 02:07:28 2.9 +++ ray/src/px/ra_ppm.c 2003/07/27 22:12:03 2.11 @@ -1,24 +1,17 @@ #ifndef lint -static const char RCSid[] = "$Id: ra_ppm.c,v 2.9 2003/02/22 02:07:28 greg Exp $"; +static const char RCSid[] = "$Id: ra_ppm.c,v 2.11 2003/07/27 22:12:03 schorsch Exp $"; #endif /* * program to convert between RADIANCE and Poskanzer Pixmaps */ #include - -#ifdef MSDOS -#include -#endif - #include - #include - #include +#include "platform.h" #include "color.h" - #include "resolu.h" @@ -101,10 +94,10 @@ char *argv[]; if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P') quiterr("input not a Poskanzer Pixmap"); ptype = inpbuf[1]; -#ifdef MSDOS +#ifdef _WIN32 if (ptype > 4) - setmode(fileno(stdin), O_BINARY); - setmode(fileno(stdout), O_BINARY); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); #endif xmax = scanint(stdin); ymax = scanint(stdin); @@ -151,10 +144,10 @@ char *argv[]; quiterr("unsupported Pixmap type"); } } else { -#ifdef MSDOS - setmode(fileno(stdin), O_BINARY); +#ifdef _WIN32 + SET_FILE_BINARY(stdin); if (binflag) - setmode(fileno(stdout), O_BINARY); + SET_FILE_BINARY(stdout); #endif /* get header info. */ if (checkheader(stdin, COLRFMT, NULL) < 0 || @@ -276,7 +269,7 @@ int (*getscan)(); for (y = ymax-1; y >= 0; y--) { if ((*getscan)(scanout, xmax, stdin) < 0) quiterr("error reading Pixmap"); - for (x = gamcor>1.01|gamcor<0.99?xmax:0; x--; ) { + for (x = (gamcor>1.01)|(gamcor<0.99)?xmax:0; x--; ) { colval(scanout[x],RED) = pow(colval(scanout[x],RED), gamcor); colval(scanout[x],GRN) = @@ -316,7 +309,7 @@ int binary, grey; for (x = grey?xmax:0; x--; ) colval(scanin[x],GRN) = bright(scanin[x]); d = 1./gamcor; - for (x = d>1.01|d<0.99?xmax:0; x--; ) { + for (x = (d>1.01)|(d<0.99)?xmax:0; x--; ) { colval(scanin[x],GRN) = pow(colval(scanin[x],GRN), d); if (!grey) { colval(scanin[x],RED) =