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.18 by greg, Fri Jun 6 19:11:21 2025 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>
10 < #include  <time.h>
12 <
10 > #include  "paths.h"
11   #include  "platform.h"
12 + #include  "rtio.h"
13   #include  "color.h"
14   #include  "resolu.h"
15  
# Line 18 | Line 17 | static const char      RCSid[] = "$Id$";
17   int  bradj = 0;                         /* brightness adjustment */
18   double  gamcor = 2.2;                   /* gamma correction value */
19   int  maxval = 255;                      /* maximum primary value */
21 char  *progname;
20   int  xmax, ymax;
21  
22   typedef int colrscanf_t(COLR *scan, int len, FILE *fp);
# Line 53 | Line 51 | main(
51          int  ptype;
52          int  i;
53          
54 <        progname = argv[0];
54 >        fixargv0(argv[0]);
55  
56          for (i = 1; i < argc; i++)
57                  if (argv[i][0] == '-')
# Line 103 | Line 101 | main(
101                  if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P')
102                          quiterr("input not a Poskanzer Pixmap");
103                  ptype = inpbuf[1];
104 < #ifdef _WIN32
104 > #if defined(_WIN32) || defined(_WIN64)
105                  if (ptype > 4)
106                          SET_FILE_BINARY(stdin);
107                  SET_FILE_BINARY(stdout);
# Line 153 | Line 151 | main(
151                                  quiterr("unsupported Pixmap type");
152                          }
153          } else {
154 < #ifdef _WIN32
154 > #if defined(_WIN32) || defined(_WIN64)
155                  SET_FILE_BINARY(stdin);
156                  if (binflag)
157                          SET_FILE_BINARY(stdout);
# Line 220 | Line 218 | ppm2ra(                /* convert 1-byte Pixmap to Radiance picture
218  
219  
220   static void
221 < ra2ppm( /* convert Radiance picture to Pixmap */
221 > ra2ppm( /* convert Radiance picture to 1-byte/sample Pixmap */
222          int  binary,
223          int  grey
224   )
# Line 585 | Line 583 | getby2(                        /* return 2-byte quantity from fp */
583   {
584          register int    lowerb, upperb;
585  
588        lowerb = getc(fp);
586          upperb = getc(fp);
587 <        if (upperb == EOF)
587 >        lowerb = getc(fp);
588 >        if (lowerb == EOF)
589                  return(EOF);
590          return(upperb<<8 | lowerb);
591   }
# Line 599 | Line 597 | putby2(                        /* put 2-byte quantity to fp */
597          register FILE   *fp
598   )
599   {
602        putc(w & 0xff, fp);
600          putc(w>>8 & 0xff, fp);
601 +        putc(w & 0xff, fp);
602          if (ferror(fp)) {
603                  fprintf(stderr, "%s: write error on PPM output\n", progname);
604                  exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines