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.17 by greg, Sat Dec 28 18:05:14 2019 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines