]> Pileus Git - grits/blob - opt/rsl/rsl-gzip.patch
* Fixing some memory leaks. A few minor ones in AWeather and a major one in RSL
[grits] / opt / rsl / rsl-gzip.patch
1 diff -ru rsl-v1.40.pre/africa_to_radar.c rsl-v1.40/africa_to_radar.c
2 --- rsl-v1.40.pre/africa_to_radar.c     2009-05-14 10:26:55.000000000 +0000
3 +++ rsl-v1.40/africa_to_radar.c 2009-05-14 10:27:13.000000000 +0000
4 @@ -73,7 +73,7 @@
5    } else {
6         fp = fopen(infile, "r");
7    }
8 -  fp = uncompress_pipe(fp);
9 +  fp = gunzip_pipe(fp);
10    n = 0;
11    
12    radar = RSL_new_radar(MAX_RADAR_VOLUMES);
13 diff -ru rsl-v1.40.pre/anyformat_to_radar.c rsl-v1.40/anyformat_to_radar.c
14 --- rsl-v1.40.pre/anyformat_to_radar.c  2009-05-14 10:26:55.000000000 +0000
15 +++ rsl-v1.40/anyformat_to_radar.c      2009-05-14 10:27:13.000000000 +0000
16 @@ -65,7 +65,7 @@
17    }
18  
19    /* Read the magic bytes. */
20 -  fp = uncompress_pipe(fp); /* If gzip available. */
21 +  fp = gunzip_pipe(fp); /* If gzip available. */
22    if (fread(magic, sizeof(magic), 1, fp) != 1) {
23         char *magic_str = (char *)calloc(sizeof(magic)+1, sizeof(char));
24         memcpy(magic_str, magic, sizeof(magic));
25 diff -ru rsl-v1.40.pre/dorade_to_radar.c rsl-v1.40/dorade_to_radar.c
26 --- rsl-v1.40.pre/dorade_to_radar.c     2009-05-14 10:26:55.000000000 +0000
27 +++ rsl-v1.40/dorade_to_radar.c 2009-05-14 10:27:13.000000000 +0000
28 @@ -97,7 +97,7 @@
29           return radar;
30      }
31  
32 -  fp = uncompress_pipe(fp); /* Transparently, use gunzip. */
33 +  fp = gunzip_pipe(fp); /* Transparently, use gunzip. */
34  
35    /**********************************************************************/
36  
37 diff -ru rsl-v1.40.pre/gzip.c rsl-v1.40/gzip.c
38 --- rsl-v1.40.pre/gzip.c        2009-05-14 10:26:55.000000000 +0000
39 +++ rsl-v1.40/gzip.c    2009-05-14 10:28:40.000000000 +0000
40 @@ -32,8 +32,8 @@
41  
42  /* Prototype definitions within this file. */
43  int no_command (char *cmd);
44 -FILE *uncompress_pipe (FILE *fp);
45 -FILE *compress_pipe (FILE *fp);
46 +FILE *gunzip_pipe (FILE *fp);
47 +FILE *gzip_pipe (FILE *fp);
48  
49  
50  /* Avoids the 'Broken pipe' message by reading the rest of the stream. */
51 @@ -67,7 +67,7 @@
52    else return !0;
53  }
54  
55 -FILE *uncompress_pipe (FILE *fp)
56 +FILE *gunzip_pipe (FILE *fp)
57  {
58    /* Pass the file pointed to by 'fp' through the gzip pipe. */
59  
60 @@ -80,13 +80,13 @@
61    dup(fileno(fp));
62  
63    fpipe = popen("gzip -q -d -f --stdout", "r");
64 -  if (fpipe == NULL) perror("uncompress_pipe");
65 +  if (fpipe == NULL) perror("gunzip_pipe");
66    close(0);
67    dup(save_fd);
68    return fpipe;
69  }
70  
71 -FILE *compress_pipe (FILE *fp)
72 +FILE *gzip_pipe (FILE *fp)
73  {
74    /* Pass the file pointed to by 'fp' through the gzip pipe. */
75  
76 @@ -100,7 +100,7 @@
77    dup(fileno(fp));
78  
79    fpipe = popen("gzip -q -1 -c", "w");
80 -  if (fpipe == NULL) perror("compress_pipe");
81 +  if (fpipe == NULL) perror("gzip_pipe");
82    close(1);
83    dup(save_fd);
84    return fpipe;
85 diff -ru rsl-v1.40.pre/lassen_to_radar.c rsl-v1.40/lassen_to_radar.c
86 --- rsl-v1.40.pre/lassen_to_radar.c     2009-05-14 10:26:55.000000000 +0000
87 +++ rsl-v1.40/lassen_to_radar.c 2009-05-14 10:27:13.000000000 +0000
88 @@ -285,7 +285,7 @@
89           perror(infile);
90           return NULL;
91      }
92 -  f = uncompress_pipe(f); /* Transparently, use gunzip. */
93 +  f = gunzip_pipe(f); /* Transparently, use gunzip. */
94  #define NEW_BUFSIZ 16384
95    setvbuf(f,NULL,_IOFBF,(size_t)NEW_BUFSIZ); /* Faster i/o? */
96    
97 diff -ru rsl-v1.40.pre/mcgill.c rsl-v1.40/mcgill.c
98 --- rsl-v1.40.pre/mcgill.c      2009-05-14 10:26:55.000000000 +0000
99 +++ rsl-v1.40/mcgill.c  2009-05-14 10:27:13.000000000 +0000
100 @@ -97,7 +97,7 @@
101     120, 120, 120, 120
102     };
103  
104 -FILE *uncompress_pipe (FILE *fp);
105 +FILE *gunzip_pipe (FILE *fp);
106  
107  /**********************************************************************/
108  mcgFile_t *mcgFileOpen(int *code, char *filename)
109 @@ -131,7 +131,7 @@
110           *code = MCG_OPEN_FILE_ERR;
111           return(NULL);
112           }
113 -   file->fp = uncompress_pipe(file->fp); /* Transparently, use gunzip. */
114 +   file->fp = gunzip_pipe(file->fp); /* Transparently, use gunzip. */
115     /* Read first (header) record from data file into buffer */
116     if (fread(buffer, sizeof(char), MCG_RECORD, file->fp) < MCG_RECORD)
117           {
118 diff -ru rsl-v1.40.pre/nsig.c rsl-v1.40/nsig.c
119 --- rsl-v1.40.pre/nsig.c        2009-05-14 10:26:55.000000000 +0000
120 +++ rsl-v1.40/nsig.c    2009-05-14 10:27:13.000000000 +0000
121 @@ -52,7 +52,7 @@
122  
123  #include "nsig.h"
124  
125 -FILE *uncompress_pipe(FILE *fp);
126 +FILE *gunzip_pipe(FILE *fp);
127  int big_endian(void);
128  int little_endian(void);
129  void swap_4_bytes(void *word);
130 @@ -76,7 +76,7 @@
131         return fp;
132    }
133  
134 -  fp = uncompress_pipe(fp); /* Transparently gunzip. */
135 +  fp = gunzip_pipe(fp); /* Transparently gunzip. */
136    return fp;
137  }
138  
139 diff -ru rsl-v1.40.pre/radar_to_uf.c rsl-v1.40/radar_to_uf.c
140 --- rsl-v1.40.pre/radar_to_uf.c 2009-05-14 10:26:55.000000000 +0000
141 +++ rsl-v1.40/radar_to_uf.c     2009-05-14 10:27:13.000000000 +0000
142 @@ -533,7 +533,7 @@
143         return;
144    }
145  
146 -  fp = compress_pipe(fp);
147 +  fp = gzip_pipe(fp);
148    RSL_radar_to_uf_fp(r, fp);
149    rsl_pclose(fp);
150  }
151 diff -ru rsl-v1.40.pre/rainbow_to_radar.c rsl-v1.40/rainbow_to_radar.c
152 --- rsl-v1.40.pre/rainbow_to_radar.c    2009-05-14 10:26:55.000000000 +0000
153 +++ rsl-v1.40/rainbow_to_radar.c        2009-05-14 10:27:13.000000000 +0000
154 @@ -88,7 +88,7 @@
155         perror(infile);
156         return NULL;
157      }
158 -    fp = uncompress_pipe(fp); /* Transparently gunzip. */
159 +    fp = gunzip_pipe(fp); /* Transparently gunzip. */
160  
161      /* Read first character and verify file format. */
162  
163 diff -ru rsl-v1.40.pre/rapic_to_radar.c rsl-v1.40/rapic_to_radar.c
164 --- rsl-v1.40.pre/rapic_to_radar.c      2009-05-14 10:26:55.000000000 +0000
165 +++ rsl-v1.40/rapic_to_radar.c  2009-05-14 10:27:13.000000000 +0000
166 @@ -22,7 +22,7 @@
167           return radar;
168         }
169    }
170 -  fp = uncompress_pipe(fp); /* Transparently gunzip. */
171 +  fp = gunzip_pipe(fp); /* Transparently gunzip. */
172    close(0); dup(fileno(fp)); /* Redirect stdin. */
173  
174    rapicparse();
175 diff -ru rsl-v1.40.pre/read_write.c rsl-v1.40/read_write.c
176 --- rsl-v1.40.pre/read_write.c  2009-05-14 10:26:55.000000000 +0000
177 +++ rsl-v1.40/read_write.c      2009-05-14 10:27:13.000000000 +0000
178 @@ -189,7 +189,7 @@
179         perror(infile);
180         return NULL;
181    }
182 -  fp = uncompress_pipe(fp);
183 +  fp = gunzip_pipe(fp);
184    (void)fread(title, sizeof(char), sizeof(title), fp);
185    if (strncmp(title, "RSL", 3) != 0) return NULL;
186  
187 @@ -372,7 +372,7 @@
188         perror(outfile);
189         return -1;
190    }
191 -  fp = compress_pipe(fp);
192 +  fp = gzip_pipe(fp);
193    n = RSL_write_radar_fp(radar, fp);
194  
195    rsl_pclose(fp);
196 diff -ru rsl-v1.40.pre/rsl.h rsl-v1.40/rsl.h
197 --- rsl-v1.40.pre/rsl.h 2009-05-14 10:26:55.000000000 +0000
198 +++ rsl-v1.40/rsl.h     2009-05-14 10:27:13.000000000 +0000
199 @@ -697,8 +697,10 @@
200  Histogram *RSL_read_histogram(char *infile);
201  
202  int no_command (char *cmd);
203 -FILE *uncompress_pipe (FILE *fp);
204 -FILE *compress_pipe (FILE *fp);
205 +FILE *gunzip_pipe (FILE *fp);
206 +FILE *gzip_pipe (FILE *fp);
207 +FILE *bunzip2_pipe (FILE *fp);
208 +FILE *bzip2_pipe (FILE *fp);
209  int rsl_pclose(FILE *fp);
210  
211  /* Carpi image generation functions. These are modified clones of the
212 diff -ru rsl-v1.40.pre/toga.c rsl-v1.40/toga.c
213 --- rsl-v1.40.pre/toga.c        2009-05-14 10:26:55.000000000 +0000
214 +++ rsl-v1.40/toga.c    2009-05-14 10:27:13.000000000 +0000
215 @@ -84,7 +84,7 @@
216  int tg_read_ray(tg_file_str *);
217  void tg_prt_head(tg_map_head_str *,int);
218  
219 -FILE *uncompress_pipe (FILE *fp);
220 +FILE *gunzip_pipe (FILE *fp);
221  
222  
223  int tg_open(char *filename,tg_file_str *tg_file)
224 @@ -102,7 +102,7 @@
225     /* Unfortunately, there is no tg_close to modularize the following
226      * pipe close.  Shouldn't be any problems anyway.
227      */
228 -   (void) uncompress_pipe(fdopen(tg_file->fd, "r")); /* Redirect through gunzip. */
229 +   (void) gunzip_pipe(fdopen(tg_file->fd, "r")); /* Redirect through gunzip. */
230     /* initialize buffer pointers, flags */
231     tg_file->buf_ind = 32769;
232     tg_file->buf_end = 32769;
233 diff -ru rsl-v1.40.pre/uf_to_radar.c rsl-v1.40/uf_to_radar.c
234 --- rsl-v1.40.pre/uf_to_radar.c 2009-05-14 10:26:55.000000000 +0000
235 +++ rsl-v1.40/uf_to_radar.c     2009-05-14 10:27:13.000000000 +0000
236 @@ -625,7 +625,7 @@
237         perror(infile);
238         return radar;
239    }
240 -  fp = uncompress_pipe(fp); /* Transparently gunzip. */
241 +  fp = gunzip_pipe(fp); /* Transparently gunzip. */
242    radar = RSL_uf_to_radar_fp(fp);
243    rsl_pclose(fp);
244         
245 diff -ru rsl-v1.40.pre/wsr88d.c rsl-v1.40/wsr88d.c
246 --- rsl-v1.40.pre/wsr88d.c      2009-05-14 10:26:55.000000000 +0000
247 +++ rsl-v1.40/wsr88d.c  2009-05-14 10:27:13.000000000 +0000
248 @@ -246,7 +246,7 @@
249    }
250  
251    if (wf->fptr == NULL) return NULL;
252 -  wf->fptr = uncompress_pipe(wf->fptr);
253 +  wf->fptr = gunzip_pipe(wf->fptr);
254  #define NEW_BUFSIZ 16384
255    setvbuf(wf->fptr,NULL,_IOFBF,(size_t)NEW_BUFSIZ); /* Faster i/o? */
256    return wf;
257 diff -ru rsl-v1.40.pre/wsr88d.h rsl-v1.40/wsr88d.h
258 --- rsl-v1.40.pre/wsr88d.h      2009-05-14 10:26:55.000000000 +0000
259 +++ rsl-v1.40/wsr88d.h  2009-05-14 10:27:13.000000000 +0000
260 @@ -212,8 +212,8 @@
261  float wsr88d_get_frequency(Wsr88d_ray *ray);
262  
263  int no_command (char *cmd);
264 -FILE *uncompress_pipe (FILE *fp);
265 -FILE *compress_pipe (FILE *fp);
266 +FILE *gunzip_pipe (FILE *fp);
267 +FILE *gzip_pipe (FILE *fp);
268  int rsl_pclose(FILE *fp);
269  
270  #endif