101 |
|
sprintf(errmsg, "duplicate modifier '%s'", modn); |
102 |
|
error(USER, errmsg); |
103 |
|
} |
104 |
< |
if (nmods >= MAXMODLIST) |
105 |
< |
error(INTERNAL, "too many modifiers"); |
104 |
> |
if (nmods >= MAXMODLIST) { |
105 |
> |
sprintf(errmsg, "too many modifiers (%d limit)", MAXMODLIST); |
106 |
> |
error(INTERNAL, errmsg); |
107 |
> |
} |
108 |
> |
if (!strcmp(modn, VOIDID)) { |
109 |
> |
sprintf(errmsg, "cannot track '%s' modifier", VOIDID); |
110 |
> |
error(USER, errmsg); |
111 |
> |
} |
112 |
|
modname[nmods++] = modn; /* XXX assumes static string */ |
113 |
|
lep->key = modn; /* XXX assumes static string */ |
114 |
|
if (binv == NULL) |
133 |
|
error(SYSTEM, "out of memory in addmodifier"); |
134 |
|
mp->outspec = outf; /* XXX assumes static string */ |
135 |
|
mp->modname = modn; /* XXX assumes static string */ |
136 |
< |
mp->params = prms; |
136 |
> |
mp->params = prms; /* XXX assumes static string */ |
137 |
|
mp->binv = ebinv; |
138 |
|
mp->nbins = bincnt; |
139 |
|
memset(mp->cbin, 0, sizeof(DCOLOR)*bincnt); |
152 |
|
char *mname[MAXMODLIST]; |
153 |
|
int i; |
154 |
|
/* find the file & store strings */ |
155 |
< |
if (wordfile(mname, getpath(fname, getrlibpath(), R_OK)) < 0) { |
155 |
> |
i = wordfile(mname, MAXMODLIST, getpath(fname, getrlibpath(), R_OK)); |
156 |
> |
if (i < 0) { |
157 |
|
sprintf(errmsg, "cannot find modifier file '%s'", fname); |
158 |
|
error(SYSTEM, errmsg); |
159 |
|
} |
160 |
+ |
if (i >= MAXMODLIST-1) { |
161 |
+ |
sprintf(errmsg, "too many modifiers (%d limit) in file '%s'", |
162 |
+ |
MAXMODLIST-1, fname); |
163 |
+ |
error(INTERNAL, errmsg); |
164 |
+ |
} |
165 |
|
for (i = 0; mname[i]; i++) /* add each one */ |
166 |
|
addmodifier(mname[i], outf, prms, binv, bincnt); |
167 |
|
} |
180 |
|
|
181 |
|
/* Initialize our process(es) */ |
182 |
|
static void |
183 |
< |
rcinit() |
183 |
> |
rcinit(void) |
184 |
|
{ |
185 |
|
int i; |
186 |
|
|
301 |
|
|
302 |
|
/* Accumulate and/or output ray contributions (child or only process) */ |
303 |
|
static void |
304 |
< |
done_contrib() |
304 |
> |
done_contrib(void) |
305 |
|
{ |
306 |
|
MODCONT *mp; |
307 |
|
int i; |
322 |
|
|
323 |
|
/* Principal calculation loop (called by main) */ |
324 |
|
void |
325 |
< |
rcontrib() |
325 |
> |
rcontrib(void) |
326 |
|
{ |
327 |
|
static int ignore_warning_given = 0; |
328 |
|
FVECT orig, direc; |