ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/header.c
(Generate patch)

Comparing ray/src/common/header.c (file contents):
Revision 2.31 by greg, Wed May 10 18:02:08 2017 UTC vs.
Revision 2.33 by greg, Sat May 25 04:00:54 2019 UTC

# Line 170 | Line 170 | printargs(             /* print arguments to a file */
170  
171   int
172   formatval(                      /* get format value (return true if format) */
173 <        char  *r,
173 >        char  fmt[MAXFMTLEN],
174          const char  *s
175   )
176   {
177          const char  *cp = FMTSTR;
178 +        char  *r = fmt;
179  
180          while (*cp) if (*cp++ != *s++) return(0);
181          while (isspace(*s)) s++;
# Line 182 | Line 183 | formatval(                     /* get format value (return true if forma
183          if (r == NULL) return(1);
184          do
185                  *r++ = *s++;
186 <        while (*s && !isspace(*s));
186 >        while (*s && !isspace(*s) && r-fmt < MAXFMTLEN-1);
187          *r = '\0';
188          return(1);
189   }
# Line 230 | Line 231 | getheader(             /* get header from file */
231  
232   struct check {
233          FILE    *fp;
234 <        char    fs[64];
234 >        char    fs[MAXFMTLEN];
235   };
236  
237  
# Line 240 | Line 241 | mycheck(                       /* check a header line for format info. */
241          void  *cp
242   )
243   {
244 <        if (!formatval(((struct check*)cp)->fs, s)
245 <                        && ((struct check*)cp)->fp != NULL) {
246 <                fputs(s, ((struct check*)cp)->fp);
247 <        }
244 >        struct check    *scp = (struct check *)cp;
245 >
246 >        if (!formatval(scp->fs, s) && scp->fp != NULL)
247 >                fputs(s, scp->fp);
248 >
249          return(0);
250   }
251  
# Line 319 | Line 321 | globmatch(                     /* check for match of s against pattern p
321   int
322   checkheader(
323          FILE  *fin,
324 <        char  *fmt,
324 >        char  fmt[MAXFMTLEN],
325          FILE  *fout
326   )
327   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines