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

Comparing ray/src/px/pflip.c (file contents):
Revision 2.2 by greg, Mon Sep 21 12:14:23 1992 UTC vs.
Revision 2.4 by greg, Mon Oct 16 11:40:11 1995 UTC

# Line 56 | Line 56 | main(argc, argv)
56   int     argc;
57   char    *argv[];
58   {
59 <        int     i;
59 >        static char     picfmt[LPICFMT+1] = PICFMT;
60 >        int     i, rval;
61   #ifdef MSDOS
62          extern int  _fmode;
63          _fmode = O_BINARY;
# Line 87 | Line 88 | char   *argv[];
88                  exit(1);
89          }
90                                          /* transfer header */
91 <        if (checkheader(fin, COLRFMT, stdout) < 0) {
91 >        if ((rval = checkheader(fin, picfmt, stdout)) < 0) {
92                  fprintf(stderr, "%s: input not a Radiance picture\n",
93                                  progname);
94                  exit(1);
95          }
96 +        if (rval)
97 +                fputformat(picfmt, stdout);
98                                          /* add new header info. */
99          printargs(i, argv, stdout);
97        fputformat(COLRFMT, stdout);
100          putchar('\n');
101                                          /* get picture size */
102          if ((order = fgetresolu(&xres, &yres, fin)) < 0) {
# Line 128 | Line 130 | scanfile()                             /* scan to the end of file */
130                  memerr();
131          if ((scanin = (COLR *)malloc(xres*sizeof(COLR))) == NULL)
132                  memerr();
133 <        for (y = yres-1; y >= 0; y--) {
133 >        for (y = yres-1; y > 0; y--) {
134                  scanpos[y] = ftell(fin);
135                  if (freadcolrs(scanin, xres, fin) < 0) {
136                          fprintf(stderr, "%s: read error\n", progname);
137                          exit(1);
138                  }
139          }
140 +        scanpos[0] = ftell(fin);
141          free((char *)scanin);
142   }
143  
# Line 170 | Line 173 | flip()                                 /* flip the picture */
173                  }
174          }
175          free((char *)scanin);
176 <        free((char *)scanout);
176 >        if (fhoriz)
177 >                free((char *)scanout);
178   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines