--- ray/src/px/ra_rgbe.c 2003/02/22 02:07:28 2.10 +++ ray/src/px/ra_rgbe.c 2004/03/28 20:33:14 2.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: ra_rgbe.c,v 2.10 2003/02/22 02:07:28 greg Exp $"; +static const char RCSid[] = "$Id: ra_rgbe.c,v 2.17 2004/03/28 20:33:14 schorsch Exp $"; #endif /* * program to convert from RADIANCE RLE to flat format @@ -8,25 +8,19 @@ static const char RCSid[] = "$Id: ra_rgbe.c,v 2.10 200 #include #include #include +#include + +#include "platform.h" +#include "rtprocess.h" #include "color.h" #include "resolu.h" -#ifdef MSDOS -#include -#endif - -extern int addhline(); - #define dumpheader(fp) fwrite(headlines, 1, headlen, fp) int bradj = 0; /* brightness adjustment */ - int doflat = 1; /* produce flat file */ - int force = 0; /* force file overwrite? */ - int findframe = 0; /* find a specific frame? */ - int frameno = 0; /* current frame number */ int fmterr = 0; /* got input format error */ char *headlines; /* current header info. */ @@ -34,10 +28,13 @@ int headlen; /* current header length */ char *progname; +static gethfunc addhline; +static int transfer(char *ospec); +static int loadheader(FILE *fp); -main(argc, argv) -int argc; -char *argv[]; + +int +main(int argc, char *argv[]) { char *ospec; int i; @@ -77,9 +74,7 @@ gotfile: progname, argv[i]); exit(1); } -#ifdef MSDOS - setmode(fileno(stdin), O_BINARY); -#endif + SET_FILE_BINARY(stdin); ospec = i==argc-2 ? argv[i+1] : (char *)NULL; while (transfer(ospec)) ; @@ -92,10 +87,12 @@ userr: } -transfer(ospec) /* transfer a Radiance picture */ -char *ospec; +static int +transfer( /* transfer a Radiance picture */ + char *ospec +) { - char oname[128]; + char oname[PATH_MAX]; FILE *fp; int order; int xmax, ymax; @@ -154,9 +151,7 @@ char *ospec; } } } -#ifdef MSDOS - setmode(fileno(fp), O_BINARY); -#endif + SET_FILE_BINARY(fp); dumpheader(fp); /* put out header */ fputs(progname, fp); if (bradj) @@ -196,9 +191,11 @@ char *ospec; } -int -addhline(s) /* add a line to our info. header */ -char *s; +static int +addhline( /* add a line to our info. header */ + char *s, + void *p +) { char fmt[32]; int n; @@ -209,7 +206,7 @@ char *s; frameno = atoi(s+6); n = strlen(s); if (headlen) - headlines = (char *)realloc(headlines, headlen+n+1); + headlines = (char *)realloc((void *)headlines, headlen+n+1); else headlines = (char *)malloc(n+1); if (headlines == NULL) { @@ -222,8 +219,10 @@ char *s; } -loadheader(fp) /* load an info. header into memory */ -FILE *fp; +static int +loadheader( /* load an info. header into memory */ + FILE *fp +) { fmterr = 0; frameno = 0; if (headlen) { /* free old header */