--- ray/src/px/ra_ppm.c 1999/02/10 08:43:41 2.8 +++ ray/src/px/ra_ppm.c 2003/07/27 22:12:03 2.11 @@ -1,30 +1,20 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +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" -extern char *malloc(); - int agryscan(), bgryscan(), aclrscan(), bclrscan(); int agryscan2(), bgryscan2(), aclrscan2(), bclrscan2(); int normval(); @@ -104,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); @@ -154,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 || @@ -212,7 +202,7 @@ int (*getscan)(); quiterr("error writing Radiance picture"); } /* free scanline */ - free((char *)scanout); + free((void *)scanout); } @@ -258,7 +248,7 @@ int binary, grey; quiterr("error writing Pixmap"); } /* free scanline */ - free((char *)scanin); + free((void *)scanin); } @@ -279,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) = @@ -293,7 +283,7 @@ int (*getscan)(); quiterr("error writing Radiance picture"); } /* free scanline */ - free((char *)scanout); + free((void *)scanout); } @@ -319,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) = @@ -357,7 +347,7 @@ int binary, grey; quiterr("error writing Pixmap"); } /* free scanline */ - free((char *)scanin); + free((void *)scanin); }