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

Comparing ray/src/px/ra_rgbe.c (file contents):
Revision 2.6 by greg, Thu Nov 18 09:55:20 1993 UTC vs.
Revision 2.7 by gregl, Fri Jan 23 09:28:29 1998 UTC

# Line 31 | Line 31 | int  argc;
31   char  *argv[];
32   {
33          int  i;
34 < #ifdef MSDOS
35 <        extern int  _fmode;
36 <        _fmode = O_BINARY;
37 <        setmode(fileno(stdin), O_BINARY);
38 <        setmode(fileno(stdout), O_BINARY);
39 < #endif
34 >
35          progname = argv[0];
36  
37          for (i = 1; i < argc; i++)
# Line 68 | Line 63 | char  *argv[];
63                                  progname, argv[i+1]);
64                  exit(1);
65          }
66 + #ifdef MSDOS
67 +        setmode(fileno(stdin), O_BINARY);
68 +        setmode(fileno(stdout), O_BINARY);
69 + #endif
70          transfer();
71          exit(0);
72   userr:
# Line 90 | Line 89 | char  *err;
89  
90   transfer()              /* transfer Radiance picture */
91   {
92 +        static char     ourfmt[LPICFMT+1] = PICFMT;
93          int     order;
94          int     xmax, ymax;
95          COLR    *scanin;
96          int     y;
97                                  /* get header info. */
98 <        if (checkheader(stdin, COLRFMT, stdout) < 0 ||
98 >        if ((y = checkheader(stdin, ourfmt, stdout)) < 0 ||
99                          (order = fgetresolu(&xmax, &ymax, stdin)) < 0)
100                  quiterr("bad picture format");
101 +        if (!y)
102 +                strcpy(ourfmt, COLRFMT);
103          fputs(progname, stdout);
104          if (bradj)
105 <                printf(" -e %+d", bradj);
106 <        if (doflat)
107 <                fputs("\n", stdout);
108 <        else {
107 <                fputs(" -r\n", stdout);
108 <                fputformat(COLRFMT, stdout);
109 <        }
105 >                fprintf(stdout, " -e %+d", bradj);
106 >        if (!doflat)
107 >                fputs(" -r", stdout);
108 >        fputc('\n', stdout);
109          if (bradj)
110                  fputexpos(pow(2.0, (double)bradj), stdout);
111 <        fputs("\n", stdout);
111 >        fputformat(ourfmt, stdout);
112 >        fputc('\n', stdout);
113          fputresolu(order, xmax, ymax, stdout);
114                                                  /* allocate scanline */
115          scanin = (COLR *)malloc(xmax*sizeof(COLR));
116          if (scanin == NULL)
117                  quiterr("out of memory in transfer");
118                                                  /* convert image */
119 <        for (y = ymax-1; y >= 0; y--) {
119 >        for (y = ymax; y--; ) {
120                  if (freadcolrs(scanin, xmax, stdin) < 0)
121                          quiterr("error reading input picture");
122                  if (bradj)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines