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

Comparing ray/src/px/ra_bn.c (file contents):
Revision 2.6 by greg, Sun Feb 27 10:17:10 1994 UTC vs.
Revision 2.9 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   *  ra_bn.c - program to convert between RADIANCE and barneyscan picture format.
6   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   */
9  
10   #include  <stdio.h>
11 <
12 < #ifdef MSDOS
16 < #include  <fcntl.h>
17 < #endif
18 <
11 > #include  <string.h>
12 > #include  <time.h>
13   #include  <math.h>
14  
15 + #include  "platform.h"
16   #include  "color.h"
22
17   #include  "resolu.h"
18  
25 extern char  *malloc();
26
19   double  gamcor = 2.0;                   /* gamma correction */
28
20   int  bradj = 0;                         /* brightness adjustment */
30
21   char  *progname;
32
22   char  errmsg[128];
34
23   FILE    *rafp, *bnfp[3];
36
24   int  xmax, ymax;
25  
26 + static void quiterr(char *err);
27 + static int openbarney(char *fname, char *mode);
28 + static int getint(FILE *fp);
29 + static void putint(int val, FILE *fp);
30 + static void ra2bn(void);
31 + static void bn2ra(void);
32  
33 < main(argc, argv)
34 < int  argc;
35 < char  *argv[];
33 >
34 > int
35 > main(
36 >        int  argc,
37 >        char  *argv[]
38 > )
39   {
40          int  reverse = 0;
41          int  i;
42 < #ifdef MSDOS
43 <        extern int  _fmode;
44 <        _fmode = O_BINARY;
49 <        setmode(fileno(stdin), O_BINARY);
50 <        setmode(fileno(stdout), O_BINARY);
51 < #endif
42 >        SET_DEFAULT_BINARY();
43 >        SET_FILE_BINARY(stdin);
44 >        SET_FILE_BINARY(stdout);
45          progname = argv[0];
46  
47          for (i = 1; i < argc; i++)
# Line 126 | Line 119 | userr:
119   }
120  
121  
122 < quiterr(err)            /* print message and exit */
123 < char  *err;
122 > static void
123 > quiterr(                /* print message and exit */
124 >        char  *err
125 > )
126   {
127          if (err != NULL) {
128                  fprintf(stderr, "%s: %s\n", progname, err);
# Line 137 | Line 132 | char  *err;
132   }
133  
134  
135 < openbarney(fname, mode)                 /* open barneyscan files */
136 < char    *fname;
137 < char    *mode;
135 > static int
136 > openbarney(                     /* open barneyscan files */
137 >        char    *fname,
138 >        char    *mode
139 > )
140   {
141          static char     suffix[3][4] = {"red", "grn", "blu"};
142          int     i;
# Line 166 | Line 163 | char   *mode;
163   }
164  
165  
166 < int
167 < getint(fp)                              /* get short int from barneyscan file */
168 < register FILE   *fp;
166 > static int
167 > getint(                         /* get short int from barneyscan file */
168 >        register FILE   *fp
169 > )
170   {
171          register short  val;
172  
# Line 179 | Line 177 | register FILE  *fp;
177   }
178  
179  
180 < putint(val, fp)                         /* put short int to barneyscan file */
181 < register int    val;
182 < register FILE   *fp;
180 > static void
181 > putint(                         /* put short int to barneyscan file */
182 >        register int    val,
183 >        register FILE   *fp
184 > )
185   {
186          putc(val&0xff, fp);
187          putc((val >> 8)&0xff, fp);
188   }
189  
190  
191 < ra2bn()                                 /* convert radiance to barneyscan */
191 > static void
192 > ra2bn(void)                                     /* convert radiance to barneyscan */
193   {
194          register int    i;
195          register COLR   *inl;
# Line 210 | Line 211 | ra2bn()                                        /* convert radiance to barneyscan */
211                  if (ferror(bnfp[0]) || ferror(bnfp[1]) || ferror(bnfp[2]))
212                          quiterr("error writing Barney files");
213          }
214 <        free((char *)inl);
214 >        free((void *)inl);
215   }
216  
217  
218 < bn2ra()                                 /* convert barneyscan to radiance */
218 > static void
219 > bn2ra(void)                                     /* convert barneyscan to radiance */
220   {
221          register int    i;
222          register COLR   *outline;
# Line 236 | Line 238 | bn2ra()                                        /* convert barneyscan to radiance */
238                  if (fwritecolrs(outline, xmax, rafp) < 0)
239                          quiterr("error writing RADIANCE file");
240          }
241 <        free((char *)outline);
241 >        free((void *)outline);
242   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines