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.9 by greg, Thu Sep 22 21:47:13 2022 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines