22 |
|
struct tmPackage *tmPkg[TM_MAXPKG]; |
23 |
|
int tmNumPkgs = 0; /* number of registered packages */ |
24 |
|
|
25 |
– |
int tmLastError; /* last error incurred by library */ |
26 |
– |
char *tmLastFunction; /* error-generating function name */ |
25 |
|
|
28 |
– |
|
26 |
|
TMstruct * |
27 |
|
tmInit( /* initialize new tone mapping */ |
28 |
|
int flags, |
75 |
|
/* zero private data */ |
76 |
|
for (i = TM_MAXPKG; i--; ) |
77 |
|
tmnew->pd[i] = NULL; |
78 |
+ |
tmnew->lastError = TM_E_OK; |
79 |
+ |
tmnew->lastFunc = "NoErr"; |
80 |
|
/* return new TMstruct */ |
81 |
|
return(tmnew); |
82 |
|
} |
89 |
|
double sf |
90 |
|
) |
91 |
|
{ |
92 |
< |
static char funcName[] = "tmSetSpace"; |
92 |
> |
static const char funcName[] = "tmSetSpace"; |
93 |
|
int i, j; |
94 |
|
/* error check */ |
95 |
|
if (tms == NULL) |
166 |
|
int len |
167 |
|
) |
168 |
|
{ |
169 |
< |
static char funcName[] = "tmCvColors"; |
169 |
> |
static const char funcName[] = "tmCvColors"; |
170 |
|
static COLOR csmall = {.5*MINLUM, .5*MINLUM, .5*MINLUM}; |
171 |
|
COLOR cmon; |
172 |
|
double lum, slum; |
244 |
|
int len |
245 |
|
) |
246 |
|
{ |
247 |
< |
static char funcName[] = "tmCvGrays"; |
247 |
> |
static const char funcName[] = "tmCvGrays"; |
248 |
|
double d; |
249 |
|
int i; |
250 |
|
|
271 |
|
int wt |
272 |
|
) |
273 |
|
{ |
274 |
< |
static char funcName[] = "tmAddHisto"; |
274 |
> |
static const char funcName[] = "tmAddHisto"; |
275 |
|
int oldorig=0, oldlen, horig, hlen; |
276 |
|
int i, j; |
277 |
|
|
374 |
|
double gamval |
375 |
|
) |
376 |
|
{ |
377 |
< |
static char funcName[] = "tmFixedMapping"; |
377 |
> |
static const char funcName[] = "tmFixedMapping"; |
378 |
|
double d; |
379 |
|
int i; |
380 |
|
|
401 |
|
double Ldmax |
402 |
|
) |
403 |
|
{ |
404 |
< |
static char funcName[] = "tmComputeMapping"; |
404 |
> |
static const char funcName[] = "tmComputeMapping"; |
405 |
|
int *histo; |
406 |
|
float *cumf; |
407 |
|
int brt0, histlen, threshold, ceiling, trimmings; |
509 |
|
int len |
510 |
|
) |
511 |
|
{ |
512 |
< |
static char funcName[] = "tmMapPixels"; |
512 |
> |
static const char funcName[] = "tmMapPixels"; |
513 |
|
int32 li, pv; |
514 |
|
|
515 |
|
if (tms == NULL || tms->lumap == NULL) |
621 |
|
|
622 |
|
int |
623 |
|
tmErrorReturn( /* error return (with message) */ |
624 |
< |
char *func, |
624 |
> |
const char *func, |
625 |
|
TMstruct *tms, |
626 |
|
int err |
627 |
|
) |
628 |
|
{ |
629 |
< |
tmLastFunction = func; |
630 |
< |
tmLastError = err; |
631 |
< |
if (tms != NULL && tms->flags & TM_F_NOSTDERR) |
632 |
< |
return(err); |
629 |
> |
if (tms != NULL) { |
630 |
> |
tms->lastFunc = func; |
631 |
> |
tms->lastError = err; |
632 |
> |
if (tms->flags & TM_F_NOSTDERR) |
633 |
> |
return(err); |
634 |
> |
} |
635 |
|
fputs(func, stderr); |
636 |
|
fputs(": ", stderr); |
637 |
|
fputs(tmErrorMessage[err], stderr); |