--- ray/src/common/tmapcolrs.c 2003/06/20 00:25:49 3.12 +++ ray/src/common/tmapcolrs.c 2004/01/02 11:36:26 3.15 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tmapcolrs.c,v 3.12 2003/06/20 00:25:49 greg Exp $"; +static const char RCSid[] = "$Id: tmapcolrs.c,v 3.15 2004/01/02 11:36:26 schorsch Exp $"; #endif /* * Routines for tone mapping on Radiance RGBE and XYZE pictures. @@ -28,13 +28,10 @@ typedef struct { TMbright inpsfb; /* encoded tm->inpsf */ } COLRDATA; -#ifdef NOPROTO -static MEM_PTR colrInit(); -static void colrNewSpace(); -#else static MEM_PTR colrInit(struct tmStruct *); static void colrNewSpace(struct tmStruct *); -#endif +static gethfunc headline; + static struct tmPackage colrPkg = { /* our package functions */ colrInit, colrNewSpace, free }; @@ -58,7 +55,7 @@ int len; if (tmTop == NULL) returnErr(TM_E_TMINVAL); - if (ls == NULL | scan == NULL | len < 0) + if ((ls == NULL) | (scan == NULL) | (len < 0)) returnErr(TM_E_ILLEGAL); #if TM_PIC_CTRANS if (tmNeedMatrix(tmTop)) { /* need floating point */ @@ -142,11 +139,13 @@ static struct radhead { static int -headline(s, rh) /* grok a header line */ -register char *s; -register struct radhead *rh; +headline( /* grok a header line */ + register char *s, + void *vrh +) { char fmt[32]; + register struct radhead *rh = vrh; if (formatval(fmt, s)) { if (!strcmp(fmt, COLRFMT)) @@ -187,8 +186,8 @@ FILE *fp; /* check arguments */ if (tmTop == NULL) returnErr(TM_E_TMINVAL); - if (lpp == NULL | xp == NULL | yp == NULL | - (fname == NULL & fp == TM_GETFILE)) + if ((lpp == NULL) | (xp == NULL) | (yp == NULL) | + ((fname == NULL) & (fp == TM_GETFILE))) returnErr(TM_E_ILLEGAL); *xp = *yp = 0; /* error precaution */ if ((inpf = fp) == TM_GETFILE && (inpf = fopen(fname, "r")) == NULL) @@ -196,8 +195,8 @@ FILE *fp; *lpp = NULL; if (cpp != TM_NOCHROMP) *cpp = NULL; info = rhdefault; /* get our header */ - getheader(inpf, headline, (char *)&info); - if (info.format == FMTBAD | info.expos <= 0. || + getheader(inpf, headline, &info); + if ((info.format == FMTBAD) | (info.expos <= 0.) || fgetresolu(xp, yp, inpf) < 0) { err = TM_E_BADFILE; goto done; } @@ -250,7 +249,7 @@ done: /* clean up */ #ifdef PCOND -int /* run pcond to map picture */ +static int /* run pcond to map picture */ dopcond(psp, xp, yp, flags, monpri, gamval, Lddyn, Ldmax, fname) BYTE **psp; int *xp, *yp; @@ -305,7 +304,7 @@ char *fname; rp = (BYTE *)malloc(sizeof(BYTE) * *xp * *yp); else rp = (BYTE *)malloc(3*sizeof(BYTE) * *xp * *yp); - if ((*psp = rp) == NULL | scan == NULL) { + if (((*psp = rp) == NULL) | (scan == NULL)) { pclose(infp); returnErr(TM_E_NOMEM); } @@ -351,8 +350,8 @@ FILE *fp; TMbright *lp; int err; /* check arguments */ - if (psp == NULL | xp == NULL | yp == NULL | monpri == NULL | - (fname == NULL & fp == TM_GETFILE)) + if ((psp == NULL) | (xp == NULL) | (yp == NULL) | (monpri == NULL) | + ((fname == NULL) & (fp == TM_GETFILE))) returnErr(TM_E_ILLEGAL); /* set defaults */ if (gamval < MINGAM) gamval = DEFGAM;