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

Comparing ray/src/px/ra_ppm.c (file contents):
Revision 2.12 by schorsch, Sun Mar 28 20:33:14 2004 UTC vs.
Revision 2.16 by greg, Tue Mar 20 18:45:04 2018 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   #include  <time.h>
12  
13   #include  "platform.h"
14 + #include  "rtio.h"
15   #include  "color.h"
16   #include  "resolu.h"
17  
# Line 103 | Line 104 | main(
104                  if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P')
105                          quiterr("input not a Poskanzer Pixmap");
106                  ptype = inpbuf[1];
107 < #ifdef _WIN32
107 > #if defined(_WIN32) || defined(_WIN64)
108                  if (ptype > 4)
109                          SET_FILE_BINARY(stdin);
110                  SET_FILE_BINARY(stdout);
# Line 153 | Line 154 | main(
154                                  quiterr("unsupported Pixmap type");
155                          }
156          } else {
157 < #ifdef _WIN32
157 > #if defined(_WIN32) || defined(_WIN64)
158                  SET_FILE_BINARY(stdin);
159                  if (binflag)
160                          SET_FILE_BINARY(stdout);
# Line 220 | Line 221 | ppm2ra(                /* convert 1-byte Pixmap to Radiance picture
221  
222  
223   static void
224 < ra2ppm( /* convert Radiance picture to Pixmap */
224 > ra2ppm( /* convert Radiance picture to 1-byte/sample Pixmap */
225          int  binary,
226          int  grey
227   )
# Line 585 | Line 586 | getby2(                        /* return 2-byte quantity from fp */
586   {
587          register int    lowerb, upperb;
588  
588        lowerb = getc(fp);
589          upperb = getc(fp);
590 <        if (upperb == EOF)
590 >        lowerb = getc(fp);
591 >        if (lowerb == EOF)
592                  return(EOF);
593          return(upperb<<8 | lowerb);
594   }
# Line 599 | Line 600 | putby2(                        /* put 2-byte quantity to fp */
600          register FILE   *fp
601   )
602   {
602        putc(w & 0xff, fp);
603          putc(w>>8 & 0xff, fp);
604 +        putc(w & 0xff, fp);
605          if (ferror(fp)) {
606                  fprintf(stderr, "%s: write error on PPM output\n", progname);
607                  exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines