--- ray/src/px/ra_ps.c 1998/10/27 09:08:27 2.22 +++ ray/src/px/ra_ps.c 2003/07/27 22:12:03 2.26 @@ -1,9 +1,6 @@ -/* Copyright (c) 1997 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: ra_ps.c,v 2.26 2003/07/27 22:12:03 schorsch Exp $"; #endif - /* * Radiance picture to PostScript file translator -- one way! */ @@ -11,9 +8,8 @@ static char SCCSid[] = "$SunId$ SGI"; #include #include #include -#ifdef MSDOS -#include -#endif + +#include "platform.h" #include "color.h" #define UPPER(c) ((c)&~0x20) /* ASCII trick */ @@ -61,7 +57,6 @@ char *progname; int xmax, ymax; /* input image dimensions */ -extern char *malloc(); extern double unit2inch(); @@ -160,9 +155,7 @@ char *argv[]; progname, argv[i+1]); exit(1); } -#ifdef MSDOS - setmode(fileno(stdin), O_BINARY); -#endif + SET_FILE_BINARY(stdin); /* get our header */ getheader(stdin, headline, NULL); if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0) @@ -193,7 +186,7 @@ double unit2inch(s) /* determine unit */ register char *s; { - static struct unit {char n; float f} u[] = { + static struct unit {char n; float f;} u[] = { 'i', 1., 'm', 1./25.4, 'c', 1./2.54, @@ -264,7 +257,7 @@ char *ps; height = atof(++s); width *= d; height *= d; - if (width >= 1. & height >= 1.) + if ((width >= 1.) & (height >= 1.)) return; } else /* check for match to standard size */ for (pp = p; pp->n[0]; pp++) @@ -305,20 +298,20 @@ char **av; /* EPS comments */ puts("%!PS-Adobe-2.0 EPSF-2.0"); printf("%%%%Title: "); printargs(ac, av, stdout); - printf("%%%%Creator: %s\n", SCCSid); + printf("%%%%Creator: %s\n", progname); printf("%%%%Pages: %d\n", ncopies); - if (landscape = xmax > pixaspect*ymax) + if ( (landscape = xmax > pixaspect*ymax) ) puts("%%Orientation: Landscape"); else puts("%%Orientation: Portrait"); - if (rotate = PWIDTH > PHEIGHT ^ landscape) { + if ( (rotate = (PWIDTH > PHEIGHT) ^ landscape) ) { pwidth = PHEIGHT; pheight = PWIDTH; } else { pwidth = PWIDTH; pheight = PHEIGHT; } - if (dpi > 100 && pixaspect >= 0.99 & pixaspect <= 1.01) + if (dpi > 100 && (pixaspect >= 0.99) & (pixaspect <= 1.01)) if (pheight/pwidth > ymax/xmax) { n = pwidth*dpi/xmax; /* floor */ iwidth = n > 0 ? (double)(n*xmax)/dpi : pwidth; @@ -474,7 +467,7 @@ ra2ps() /* convert Radiance scanlines to 6-bit */ } putchar('\n'); /* free scanline */ - free((char *)scanin); + free((void *)scanin); }