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.24 by greg, Sat Dec 28 18:05:14 2019 UTC

# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10   #include "copyright.h"
11  
12   #include <ctype.h>
13 #include <string.h>
13  
14   #include "platform.h"
15   #include "rtio.h"
# Line 38 | Line 37 | wordfile(                      /* get words from fname, put in words */
37                  return(-1);
38          if ((fd = open(fname, 0)) < 0)
39                  return(-1);                     /* open error */
41        SET_FD_BINARY(fd);                      /* Windows bug workaround */
40          words[0] = NULL;
41          while (nargs > 1 && (n += read(fd, buf+n, MAXWLEN-n)) > 0) {
42 +                int     dlen = n;
43                  int     crem = 0;
44                  if (n > MAXWLEN/2)              /* check for mid-word end */
45                          while (!isspace(buf[--n])) {
# Line 57 | Line 56 | wordfile(                      /* get words from fname, put in words */
56                  words += n; nargs -= n;
57                  wrdcnt += n;
58                  if ((n = crem) > 0)             /* move remainder */
59 <                        memmove(buf, buf+MAXWLEN-crem, crem);
59 >                        memmove(buf, buf+dlen-crem, crem);
60          }
61   done:
62          close(fd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines