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

Comparing ray/src/util/rcode_norm.c (file contents):
Revision 2.6 by greg, Wed Nov 13 18:20:47 2019 UTC vs.
Revision 2.9 by greg, Fri Jul 24 16:00:10 2020 UTC

# Line 38 | Line 38 | encode_normals(NORMCODEC *ncp)
38          long    nexpected = (long)ncp->res.xr * ncp->res.yr;
39  
40          if (ncp->inpfmt[0]) {
41 <                if (strstr(ncp->inpfmt, "ascii") != NULL)
41 >                if (!strcmp(ncp->inpfmt, "ascii"))
42                          ncp->format = 'a';
43 <                else if (strstr(ncp->inpfmt, "float") != NULL)
43 >                else if (!strcmp(ncp->inpfmt, "float"))
44                          ncp->format = 'f';
45 <                else if (strstr(ncp->inpfmt, "double") != NULL)
45 >                else if (!strcmp(ncp->inpfmt, "double"))
46                          ncp->format = 'd';
47                  else {
48                          fputs(ncp->inpname, stderr);
# Line 52 | Line 52 | encode_normals(NORMCODEC *ncp)
52                          return 0;
53                  }
54          }
55 +        if (ncp->format == 'a')
56 +                SET_FILE_TEXT(ncp->finp);
57  
58          do {
59                  int     ok = 0;
# Line 189 | Line 191 | pixel_normals(NORMCODEC *ncp, int unbuf)
191                  fputs(": can only handle standard pixel ordering\n", stderr);
192                  return 0;
193          }
194 +
195          while (scanf("%d %d", &x, &y) == 2) {
196  
197                  y = ncp->res.yr-1 - y;
# Line 339 | Line 342 | main(int argc, char *argv[])
342                  fputs(": cannot open for writing\n", stderr);
343                  return 1;
344          }
345 <        SET_FILE_BINARY(nc.finp);
346 <        if (reverse || nc.format != 'a')
344 <                SET_FILE_BINARY(stdout);
345 >        SET_FILE_BINARY(nc.finp);       /* starting assumption */
346 >        SET_FILE_BINARY(stdout);
347   #ifdef getc_unlocked                    /* avoid stupid semaphores */
348          flockfile(nc.finp);
349          flockfile(stdout);
# Line 349 | Line 351 | main(int argc, char *argv[])
351                                          /* read/copy header */
352          if (!process_nc_header(&nc, a, argv))
353                  return 1;
354 +
355 +        if (reverse && nc.format == 'a')
356 +                SET_FILE_TEXT(stdout);
357                                          /* process data */
358          if (!reverse) {
359                  if (!encode_normals(&nc))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines