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

Comparing ray/src/common/normcodec.c (file contents):
Revision 2.7 by greg, Wed Aug 24 19:55:58 2022 UTC vs.
Revision 2.8 by greg, Thu Sep 22 21:45:28 2022 UTC

# Line 39 | Line 39 | headline(char *s, void *p)
39                  ncp->swapped = (nativebigendian() != rv);
40                  return 0;
41          }
42 +        if (!strncmp(s, "NCOMP=", 6)) {
43 +                if (atoi(s+6) != 3) {
44 +                        if (ncp->hdrflags & HF_STDERR) {
45 +                                fputs(ncp->inpname, stderr);
46 +                                fputs(": NCOMP must equal 3\n", stderr);
47 +                        }
48 +                        return -1;
49 +                }
50 +                return 0;
51 +        }
52 +        if (!strncmp(s, "NROWS=", 6)) {
53 +                ncp->res.yr = atoi(s+6);
54 +                return 0;
55 +        }
56 +        if (!strncmp(s, "NCOLS=", 6)) {
57 +                ncp->res.xr = atoi(s+6);
58 +                return 0;
59 +        }
60          if (ncp->hdrflags & HF_HEADOUT)
61                  fputs(s, stdout);       /* copy to standard output */
62          return 1;
# Line 58 | Line 76 | process_nc_header(NORMCODEC *ncp, int ac, char *av[])
76                  return 0;
77          }
78                                          /* get resolution string? */
79 <        if (ncp->hdrflags & HF_RESIN && !fgetsresolu(&ncp->res, ncp->finp)) {
79 >        if (ncp->hdrflags & HF_RESIN &&
80 >                        (ncp->res.xr <= 0) | (ncp->res.yr <= 0) &&
81 >                        !fgetsresolu(&ncp->res, ncp->finp)) {
82                  if (ncp->hdrflags & HF_STDERR) {
83                          fputs(ncp->inpname, stderr);
84                          fputs(": bad resolution string\n", stderr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines