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.8 by gregl, Fri Jan 23 11:38:39 1998 UTC vs.
Revision 2.17 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  program to convert from RADIANCE RLE to flat format
6   */
7  
8   #include  <stdio.h>
9   #include  <math.h>
10 + #include  <time.h>
11 + #include  <string.h>
12 +
13 + #include  "platform.h"
14 + #include  "rtprocess.h"
15   #include  "color.h"
16   #include  "resolu.h"
17  
16 #ifdef MSDOS
17 #include  <fcntl.h>
18 #endif
19
20 extern char     *malloc(), *realloc(), *tempbuffer();
21 extern int      addhline();
22
18   #define dumpheader(fp)  fwrite(headlines, 1, headlen, fp)
19  
20   int  bradj = 0;                         /* brightness adjustment */
26
21   int  doflat = 1;                        /* produce flat file */
28
22   int  force = 0;                         /* force file overwrite? */
30
23   int  findframe = 0;                     /* find a specific frame? */
32
24   int  frameno = 0;                       /* current frame number */
25   int  fmterr = 0;                        /* got input format error */
26   char  *headlines;                       /* current header info. */
# Line 37 | Line 28 | int  headlen;                          /* current header length */
28  
29   char  *progname;
30  
31 + static gethfunc addhline;
32 + static int transfer(char *ospec);
33 + static int loadheader(FILE *fp);
34  
35 < main(argc, argv)
36 < int  argc;
37 < char  *argv[];
35 >
36 > int
37 > main(int  argc, char  *argv[])
38   {
39          char    *ospec;
40          int  i;
# Line 80 | Line 74 | gotfile:
74                                  progname, argv[i]);
75                  exit(1);
76          }
77 < #ifdef MSDOS
84 <        setmode(fileno(stdin), O_BINARY);
85 < #endif
77 >        SET_FILE_BINARY(stdin);
78          ospec = i==argc-2 ? argv[i+1] : (char *)NULL;
79          while (transfer(ospec))
80                  ;
# Line 95 | Line 87 | userr:
87   }
88  
89  
90 < transfer(ospec)                 /* transfer a Radiance picture */
91 < char    *ospec;
90 > static int
91 > transfer(                       /* transfer a Radiance picture */
92 >        char    *ospec
93 > )
94   {
95 <        char    oname[128];
95 >        char    oname[PATH_MAX];
96          FILE    *fp;
97          int     order;
98          int     xmax, ymax;
# Line 157 | Line 151 | char   *ospec;
151                          }
152                  }
153          }
154 < #ifdef MSDOS
161 <        setmode(fileno(fp), O_BINARY);
162 < #endif
154 >        SET_FILE_BINARY(fp);
155          dumpheader(fp);                 /* put out header */
156          fputs(progname, fp);
157          if (bradj)
# Line 199 | Line 191 | char   *ospec;
191   }
192  
193  
194 < addhline(s)                     /* add a line to our info. header */
195 < char    *s;
194 > static int
195 > addhline(                       /* add a line to our info. header */
196 >        char    *s,
197 >        void    *p
198 > )
199   {
200          char    fmt[32];
201          int     n;
# Line 211 | Line 206 | char   *s;
206                  frameno = atoi(s+6);
207          n = strlen(s);
208          if (headlen)
209 <                headlines = (char *)realloc(headlines, headlen+n+1);
209 >                headlines = (char *)realloc((void *)headlines, headlen+n+1);
210          else
211                  headlines = (char *)malloc(n+1);
212          if (headlines == NULL) {
# Line 220 | Line 215 | char   *s;
215          }
216          strcpy(headlines+headlen, s);
217          headlen += n;
218 +        return(0);
219   }
220  
221  
222 < loadheader(fp)                  /* load an info. header into memory */
223 < FILE    *fp;
222 > static int
223 > loadheader(                     /* load an info. header into memory */
224 >        FILE    *fp
225 > )
226   {
227          fmterr = 0; frameno = 0;
228          if (headlen) {                  /* free old header */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines