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

Comparing ray/src/common/wordfile.c (file contents):
Revision 2.21 by greg, Thu May 12 16:30:39 2016 UTC vs.
Revision 2.22 by schorsch, Fri May 13 09:12:19 2016 UTC

# Line 29 | Line 29 | wordfile(                      /* get words from fname, put in words */
29   {
30          int     wrdcnt = 0;
31          int     n = 0;
32 +        int dlen = 0;
33          int     fd;
34          char    buf[MAXWLEN];
35                                          /* load file into buffer */
# Line 38 | Line 39 | wordfile(                      /* get words from fname, put in words */
39                  return(-1);
40          if ((fd = open(fname, 0)) < 0)
41                  return(-1);                     /* open error */
41        SET_FD_BINARY(fd);                      /* Windows bug workaround */
42          words[0] = NULL;
43          while (nargs > 1 && (n += read(fd, buf+n, MAXWLEN-n)) > 0) {
44 +                dlen = n;
45                  int     crem = 0;
46                  if (n > MAXWLEN/2)              /* check for mid-word end */
47                          while (!isspace(buf[--n])) {
# Line 57 | Line 58 | wordfile(                      /* get words from fname, put in words */
58                  words += n; nargs -= n;
59                  wrdcnt += n;
60                  if ((n = crem) > 0)             /* move remainder */
61 <                        memmove(buf, buf+MAXWLEN-crem, crem);
61 >                        memmove(buf, buf+dlen-crem, crem);
62          }
63   done:
64          close(fd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines