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

Comparing ray/src/rt/rv2.c (file contents):
Revision 1.24 by greg, Thu Jul 18 16:37:59 1991 UTC vs.
Revision 1.27 by greg, Mon Aug 26 12:53:21 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1987 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 306 | Line 306 | char  *str, *dsc;
306   int  typ;
307   register union {int i; double d; COLOR C;}  *ptr;
308   {
309 +        extern char  *index();
310          int  i0;
311          double  d0, d1, d2;
312          char  buf[48];
# Line 339 | Line 340 | register union {int i; double d; COLOR C;}  *ptr;
340                          sprintf(buf, " (%c): ", ptr->i ? 'y' : 'n');
341                          (*dev->comout)(buf);
342                          (*dev->comin)(buf, NULL);
343 +                        if (buf[0] == '\0' ||
344 +                                        index("yY+1tTnN-0fF", buf[0]) == NULL)
345 +                                break;
346                  }
347 <                ptr->i = tolower(buf[0]) == 'y';
347 >                ptr->i = index("yY+1tT", buf[0]) != NULL;
348                  break;
349          case 'C':                       /* color */
350                  if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
# Line 468 | Line 472 | register char  *s;
472                  break;
473          default:;
474   badparam:
475 +                *sskip(s) = '\0';
476                  sprintf(errmsg, "%s: unknown variable", s);
477                  error(COMMAND, errmsg);
478                  break;
# Line 569 | Line 574 | char  *s;
574          fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp);
575  
576          scanline = (COLR *)malloc(hresolu*sizeof(COLR));
577 <        if (scanline == NULL)
578 <                error(SYSTEM, "out of memory in writepict");
577 >        if (scanline == NULL) {
578 >                error(COMMAND, "not enough memory!");
579 >                fclose(fp);
580 >                unlink(fname);
581 >                return;
582 >        }
583          for (y = vresolu-1; y >= 0; y--) {
584                  getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu);
585                  if (fwritecolrs(scanline, hresolu, fp) < 0)
586                          break;
587          }
588 +        free((char *)scanline);
589          if (fclose(fp) < 0)
590                  error(COMMAND, "write error");
581        free((char *)scanline);
591   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines