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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.51 by greg, Mon May 17 17:03:53 2010 UTC vs.
Revision 2.54 by greg, Fri Jun 1 22:55:14 2012 UTC

# Line 78 | Line 78 | int  nforked = 0;
78  
79   char  *progname;
80   int  verbose = 0;
81 + int  nowarn = 0;
82   unsigned  timelim = 0;
83   int  rvrlim = -1;
84  
# Line 114 | Line 115 | main(
115                  }
116                  if (argv[i][0] == '-')
117                          switch (argv[i][1]) {
118 +                        case 'w':
119 +                                if (!argv[i][2])
120 +                                        nowarn = !nowarn;
121 +                                else if (argv[i][2] == '+')
122 +                                        nowarn = 0;
123 +                                else if (argv[i][2] == '-')
124 +                                        nowarn = 1;
125 +                                break;
126                          case 'v':
127                                  switch (argv[i][2]) {
128                                  case '\0':      /* verbose option */
# Line 195 | Line 204 | main(
204                                          break;
205                                  outfile = argv[++i];
206                                  continue;
207 <                        } else if (i >= argc-1)
208 <                                break;
207 >                        }
208 >                else if (i >= argc-1)
209 >                        break;
210                  rpargv[rpargc++] = argv[i];
211          }
212          if (i >= argc) {
# Line 225 | Line 235 | dolock(                /* lock or unlock a file */
235          if (fcntl(fd, F_SETLKW, &fls) < 0) {
236                  fprintf(stderr, "%s: cannot lock/unlock file: %s\n",
237                                  progname, strerror(errno));
238 <                exit(1);
238 >                _exit(1);
239          }
240   }
241  
# Line 253 | Line 263 | init(                  /* set up output file and start rpict */
263                  sflock(F_UNLCK);
264          }
265                                          /* compute piece size */
266 +        hr = hres; vr = vres;
267 +        if (pixaspect > FTINY)
268 +                normaspect(viewaspect(&ourview), &pixaspect, &hr, &vr);
269          hres /= hmult;
270          vres /= vmult;
271          if (hres <= 0 || vres <= 0) {
# Line 260 | Line 273 | init(                  /* set up output file and start rpict */
273                  exit(1);
274          }
275          normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
276 +        if (!nowarn && (hr != hres*hmult) | (vr != vres*vmult))
277 +                fprintf(stderr,
278 +                "%s: warning - resolution changed from %dx%d to %dx%d\n",
279 +                                progname, hr, vr, hres*hmult, vres*vmult);
280          sprintf(hrbuf, "%d", hres);
281          rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
282          sprintf(vrbuf, "%d", vres);
# Line 278 | Line 295 | init(                  /* set up output file and start rpict */
295                  fputs(VIEWSTR, fp);
296                  fprintview(&ourview, fp);
297                  putc('\n', fp);
298 +                fputnow(fp);
299                  if (pixaspect < .99 || pixaspect > 1.01)
300                          fputaspect(pixaspect, fp);
301                  fputformat(COLRFMT, fp);
# Line 555 | Line 573 | int    ypos
573                                  /* lock file section so NFS doesn't mess up */
574          fls.l_whence = 0;
575          fls.l_type = F_WRLCK;
576 + #if 0
577          if (fcntl(outfd, F_SETLKW, &fls) < 0)
578                  filerr("lock");
579 + #else
580 +        dolock(outfd, F_WRLCK);
581   #endif
582 + #endif
583                                  /* write new piece to file */
584          if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0)
585                  filerr("seek");
# Line 577 | Line 599 | int    ypos
599                  }
600   #if NFS
601          fls.l_type = F_UNLCK;           /* release lock */
602 + #if 0
603          if (fcntl(outfd, F_SETLKW, &fls) < 0)
604                  filerr("lock");
605 + #else
606 +        dolock(outfd, F_UNLCK);
607 + #endif
608   #endif
609          if (verbose) {                          /* notify caller */
610                  printf("%d %d done\n", xpos, ypos);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines