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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.63 by greg, Sat Apr 9 18:05:18 2011 UTC vs.
Revision 1.64 by greg, Sat Apr 16 00:39:07 2011 UTC

# Line 20 | Line 20 | static const char RCSid[] = "$Id$";
20   #define MAXMODLIST      1024            /* maximum modifiers we'll track */
21   #endif
22  
23 < size_t  treebufsiz = BUFSIZ;            /* current tree buffer size */
23 > ssize_t treebufsiz = BUFSIZ;            /* current tree buffer size */
24  
25   typedef double  DCOLOR[3];              /* double-precision color */
26  
# Line 1117 | Line 1117 | wait_rproc(void)
1117                          } else if (rt->nbr + BUFSIZ > rt->bsiz) {
1118                                  if (rt->bsiz + BUFSIZ <= treebufsiz)
1119                                          rt->bsiz = treebufsiz;
1120 <                                else
1121 <                                        treebufsiz = rt->bsiz += BUFSIZ;
1120 >                                else if ((treebufsiz = rt->bsiz += BUFSIZ) < 0)
1121 >                                        error(INTERNAL,
1122 >                                            "ray buffer does not fit memory");
1123                                  rt->buf = (char *)realloc(rt->buf, rt->bsiz);
1124                          }
1125                          if (rt->buf == NULL)
1126                                  error(SYSTEM, "out of memory in wait_rproc");
1127 <                        nr = read(rt->pd.r, rt->buf+rt->nbr, rt->bsiz-rt->nbr);
1128 <                        if (nr <= 0)
1127 >                        nr = rt->bsiz - rt->nbr;
1128 >                        if (nr & ~0x7fffffff)   /* avoid 32-bit OS issues */
1129 >                                nr = 0x7fffffff;
1130 >                        nr = read(rt->pd.r, rt->buf+rt->nbr, nr);
1131 >                        if (nr < 0)
1132 >                                error(SYSTEM, "read error from rtrace");
1133 >                        if (!nr)
1134                                  error(USER, "rtrace process died");
1135                          rt->nbr += nr;          /* advance & check */
1136                          if (rt->nbr >= 6 && !memcmp(rt->buf+rt->nbr-6,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines