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

Comparing ray/src/px/pvalue.c (file contents):
Revision 2.37 by greg, Wed Aug 14 18:20:02 2019 UTC vs.
Revision 2.38 by greg, Thu Feb 6 19:33:32 2020 UTC

# Line 312 | Line 312 | unkopt:
312                  SET_FILE_BINARY(stdout);
313                                          /* get header */
314                  if (header) {
315 <                        if (checkheader(fin, fmtid, stdout) < 0) {
316 <                                fprintf(stderr, "%s: wrong input format\n",
317 <                                                progname);
315 >                        getheader(fin, checkhead, stdout);
316 >                        if (wrongformat) {
317 >                                fprintf(stderr, "%s: wrong input format (expected %s)\n",
318 >                                                progname, fmtid);
319                                  quit(1);
320                          }
321                          if (fin2 != NULL) {
# Line 361 | Line 362 | unkopt:
362                  if ((format != 'a') & (format != 'i'))
363                          SET_FILE_BINARY(stdout);
364                                                  /* get header */
365 <                getheader(fin, checkhead, NULL);
365 >                getheader(fin, checkhead, header ? stdout : (FILE *)NULL);
366                  if (wrongformat) {
367                          fprintf(stderr,
368                                  "%s: input not a Radiance RGBE picture\n",
# Line 402 | Line 403 | checkhead(                             /* deal with line from header */
403          void    *p
404   )
405   {
406 +        FILE    *fout = (FILE *)p;
407          char    fmt[MAXFMTLEN];
408          double  d;
409          COLOR   ctmp;
410          int     rv;
411  
412          if (formatval(fmt, line)) {
413 <                if (!strcmp(fmt, CIEFMT))
413 >                if (reverse)
414 >                        wrongformat = strcmp(fmt, fmtid);
415 >                else if (!strcmp(fmt, CIEFMT))
416                          mybright = &xyz_bright;
417                  else if (!strcmp(fmt, COLRFMT))
418                          mybright = &rgb_bright;
# Line 424 | Line 428 | checkhead(                             /* deal with line from header */
428                                  colval(exposure,GRN)/colval(ctmp,GRN),
429                                  colval(exposure,BLU)/colval(ctmp,BLU));
430                  doexposure++;
431 <        } else if (reverse && (rv = isbigendian(line)) >= 0) {
432 <                swapbytes = (nativebigendian() != rv);
433 <        } else if (header)
434 <                fputs(line, stdout);
431 >        } else if ((rv = isbigendian(line)) >= 0) {
432 >                if (reverse)
433 >                        swapbytes = (nativebigendian() != rv);
434 >        } else if (fout != NULL)
435 >                fputs(line, fout);
436          return(0);
437   }
438  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines