28 |
|
TMbright inpsfb; /* encoded tm->inpsf */ |
29 |
|
} COLRDATA; |
30 |
|
|
31 |
< |
static MEM_PTR colrInit(TMstruct *); |
31 |
> |
static void * colrInit(TMstruct *); |
32 |
|
static void colrNewSpace(TMstruct *); |
33 |
|
static gethfunc headline; |
34 |
|
|
122 |
|
} |
123 |
|
} |
124 |
|
} else if (tms->flags & TM_F_BW) { |
125 |
< |
cmon[RED] = cmon[GRN] = cmon[BLU] = li; |
125 |
> |
for (j = 3; j--; ) |
126 |
> |
cs[3*i+j] = tms->cdiv[j]/(TM_BRES>>8); |
127 |
> |
continue; |
128 |
|
} else { |
129 |
|
for (j = 3; j--; ) |
130 |
|
cmon[j] *= (cmon[j] > 0); |
254 |
|
if (fp == NULL) |
255 |
|
fclose(inpf); |
256 |
|
if (scanin != NULL) |
257 |
< |
free((MEM_PTR)scanin); |
257 |
> |
free(scanin); |
258 |
|
if (err != TM_E_OK) { |
259 |
|
if (*lpp != NULL) |
260 |
< |
free((MEM_PTR)*lpp); |
260 |
> |
free(*lpp); |
261 |
|
if (cpp != TM_NOCHROMP && *cpp != NULL) |
262 |
< |
free((MEM_PTR)*cpp); |
262 |
> |
free(*cpp); |
263 |
|
returnErr(err); |
264 |
|
} |
265 |
|
returnOK; |
331 |
|
for (y = 0; y < *yp; y++) { |
332 |
|
if (freadcolrs(scan, *xp, infp) < 0) { |
333 |
|
pclose(infp); |
334 |
< |
free((MEM_PTR)scan); |
335 |
< |
free((MEM_PTR)*psp); |
334 |
> |
free(scan); |
335 |
> |
free(*psp); |
336 |
|
*psp = NULL; |
337 |
|
returnErr(TM_E_BADFILE); |
338 |
|
} |
347 |
|
*rp++ = scan[x][BLU]; |
348 |
|
} |
349 |
|
} |
350 |
< |
free((MEM_PTR)scan); |
350 |
> |
free(scan); |
351 |
|
pclose(infp); |
352 |
|
returnOK; |
353 |
|
} |
398 |
|
if (flags & TM_F_BW) { |
399 |
|
*psp = (uby8 *)malloc(sizeof(uby8) * *xp * *yp); |
400 |
|
if (*psp == NULL) { |
401 |
< |
free((MEM_PTR)lp); |
401 |
> |
free(lp); |
402 |
|
tmDone(tms); |
403 |
|
returnErr(TM_E_NOMEM); |
404 |
|
} |
416 |
|
err = tmMapPixels(tms, *psp, lp, cp, *xp * *yp); |
417 |
|
|
418 |
|
done: /* clean up */ |
419 |
< |
free((MEM_PTR)lp); |
419 |
> |
free(lp); |
420 |
|
tmDone(tms); |
421 |
|
if (err != TM_E_OK) { /* free memory on error */ |
422 |
< |
free((MEM_PTR)*psp); |
422 |
> |
free(*psp); |
423 |
|
*psp = NULL; |
424 |
|
returnErr(err); |
425 |
|
} |
447 |
|
} |
448 |
|
|
449 |
|
|
450 |
< |
static MEM_PTR |
450 |
> |
static void * |
451 |
|
colrInit(tms) /* initialize private data for tone mapping */ |
452 |
|
TMstruct *tms; |
453 |
|
{ |
457 |
|
cd = (COLRDATA *)malloc(sizeof(COLRDATA)); |
458 |
|
if (cd == NULL) |
459 |
|
return(NULL); |
460 |
< |
tms->pd[colrReg] = (MEM_PTR)cd; |
460 |
> |
tms->pd[colrReg] = (void *)cd; |
461 |
|
/* compute gamma table */ |
462 |
|
for (i = GAMTSZ; i--; ) |
463 |
|
cd->gamb[i] = 256.*pow((i+.5)/GAMTSZ, 1./tms->mongam); |
464 |
|
/* compute color and scale factors */ |
465 |
|
colrNewSpace(tms); |
466 |
< |
return((MEM_PTR)cd); |
466 |
> |
return((void *)cd); |
467 |
|
} |