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

Comparing ray/src/px/pfilt.c (file contents):
Revision 2.9 by greg, Fri Jun 25 15:01:17 1993 UTC vs.
Revision 2.14 by greg, Wed May 31 08:50:27 1995 UTC

# Line 53 | Line 53 | double spread = 1e-4;          /* spread for star points */
53  
54   char  *tfname = NULL;
55  
56 + char  template[] = TEMPLATE;
57 +
58   char  *lampdat = "lamp.tab";    /* lamp data file */
59  
60   int  order;                     /* scanline ordering of input */
# Line 100 | Line 102 | char  **argv;
102          if (signal(SIGINT, quit) == SIG_IGN)
103                  signal(SIGINT, SIG_IGN);
104          if (signal(SIGHUP, quit) == SIG_IGN)
105 <                signal(SIGINT, SIG_IGN);
105 >                signal(SIGHUP, SIG_IGN);
106          signal(SIGTERM, quit);
107          signal(SIGPIPE, quit);
108   #ifdef  SIGXCPU
# Line 217 | Line 219 | char  **argv;
219                          fprintf(stderr, "%s: unknown lamp type\n", lamptype);
220                          quit(1);
221                  }
222 <                for (i = 0; i < 3; i++)
223 <                        if (lampcolor[i] > 1e-4)
224 <                                colval(exposure,i) /= lampcolor[i];
222 >                for (j = 0; j < 3; j++)
223 >                        if (lampcolor[j] > 1e-4)
224 >                                colval(exposure,j) /= lampcolor[j];
225                  freelamps();
226          }
227                                          /* open input file */
# Line 227 | Line 229 | char  **argv;
229                  if (singlepass)
230                          fin = stdin;
231                  else {
232 <                        tfname = mktemp(TEMPLATE);
232 >                        tfname = mktemp(template);
233                          if ((fin = fopen(tfname, "w+")) == NULL) {
234                                  fprintf(stderr, "%s: can't create ", progname);
235                                  fprintf(stderr, "temp file \"%s\"\n", tfname);
# Line 381 | Line 383 | FILE  *in;
383                                  if (freadscan(scanin[yread%barsize],
384                                                  xres, in) < 0) {
385                                          fprintf(stderr,
386 <                                                "%s: bad read (y=%d)\n",
386 >                                                "%s: truncated input (y=%d)\n",
387                                                  progname, yres-1-yread);
388                                          quit(1);
389                                  }
# Line 443 | Line 445 | scan2init()                    /* prepare scanline arrays */
445          }
446          barsize = 2*yrad + 1;
447          scanin = (COLOR **)malloc(barsize*sizeof(COLOR *));
448 +        if (scanin == NULL)
449 +                goto memerr;
450          for (i = 0; i < barsize; i++) {
451                  scanin[i] = (COLOR *)malloc(xres*sizeof(COLOR));
452 <                if (scanin[i] == NULL) {
453 <                        fprintf(stderr, "%s: out of memory\n", progname);
450 <                        quit(1);
451 <                }
452 >                if (scanin[i] == NULL)
453 >                        goto memerr;
454          }
455          if (obarsize > 0) {
456                  scoutbar = (COLOR **)malloc(obarsize*sizeof(COLOR *));
457                  greybar = (float **)malloc(obarsize*sizeof(float *));
458 +                if (scoutbar == NULL | greybar == NULL)
459 +                        goto memerr;
460                  for (i = 0; i < obarsize; i++) {
461                          scoutbar[i] = (COLOR *)malloc(ncols*sizeof(COLOR));
462                          greybar[i] = (float *)malloc(ncols*sizeof(float));
463 <                        if (scoutbar[i] == NULL | greybar[i] == NULL) {
464 <                                fprintf(stderr, "%s: out of memory\n",
461 <                                                progname);
462 <                                quit(1);
463 <                        }
463 >                        if (scoutbar[i] == NULL | greybar[i] == NULL)
464 >                                goto memerr;
465                  }
466          } else {
467                  scanout = (COLOR *)malloc(ncols*sizeof(COLOR));
468 <                if (scanout == NULL) {
469 <                        fprintf(stderr, "%s: out of memory\n", progname);
469 <                        quit(1);
470 <                }
468 >                if (scanout == NULL)
469 >                        goto memerr;
470          }
471                                          /* record pixel aspect ratio */
472          if (!correctaspect) {
# Line 488 | Line 487 | scan2init()                    /* prepare scanline arrays */
487          printf("\n");
488                                          /* write out resolution */
489          fputresolu(order, ncols, nrows, stdout);
490 +        return;
491 + memerr:
492 +        fprintf(stderr, "%s: out of memory\n", progname);
493 +        quit(1);
494   }
495  
496  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines