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

Comparing ray/src/util/eplus_idf.c (file contents):
Revision 2.9 by greg, Thu Feb 13 17:33:37 2014 UTC vs.
Revision 2.10 by greg, Thu Feb 13 17:39:39 2014 UTC

# Line 225 | Line 225 | idf_read_comment(char *buf, int len, FILE *fp)
225   {
226          int     incomm = 0;
227          char    *cp = buf;
228 <        char    dummyc;
228 >        char    dummys[2];
229          int     c;
230  
231          if ((buf == NULL) | (len <= 0)) {
232 <                buf = &dummyc;
233 <                len = 1;
232 >                buf = dummys;
233 >                len = sizeof(dummys);
234          }
235          while ((c = getc(fp)) != EOF &&
236                          (isspace(c) || (incomm += (c == '!')))) {
237                  if (c == '\n')
238                          incomm = 0;
239 <                if (cp-buf < len-1)
239 >                if (cp-buf < len-2)
240                          *cp++ = c;
241 +                else if (cp-buf == len-2)
242 +                        *cp++ = '\n';
243          }
244          *cp = '\0';
245          if (c != EOF)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines