]> Pileus Git - grits/blobdiff - 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
diff --git a/opt/rsl/rsl-gzip.patch b/opt/rsl/rsl-gzip.patch
new file mode 100644 (file)
index 0000000..9b5f8a5
--- /dev/null
@@ -0,0 +1,270 @@
+diff -ru rsl-v1.40.pre/africa_to_radar.c rsl-v1.40/africa_to_radar.c
+--- rsl-v1.40.pre/africa_to_radar.c    2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/africa_to_radar.c        2009-05-14 10:27:13.000000000 +0000
+@@ -73,7 +73,7 @@
+   } else {
+       fp = fopen(infile, "r");
+   }
+-  fp = uncompress_pipe(fp);
++  fp = gunzip_pipe(fp);
+   n = 0;
+   
+   radar = RSL_new_radar(MAX_RADAR_VOLUMES);
+diff -ru rsl-v1.40.pre/anyformat_to_radar.c rsl-v1.40/anyformat_to_radar.c
+--- rsl-v1.40.pre/anyformat_to_radar.c 2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/anyformat_to_radar.c     2009-05-14 10:27:13.000000000 +0000
+@@ -65,7 +65,7 @@
+   }
+   /* Read the magic bytes. */
+-  fp = uncompress_pipe(fp); /* If gzip available. */
++  fp = gunzip_pipe(fp); /* If gzip available. */
+   if (fread(magic, sizeof(magic), 1, fp) != 1) {
+       char *magic_str = (char *)calloc(sizeof(magic)+1, sizeof(char));
+       memcpy(magic_str, magic, sizeof(magic));
+diff -ru rsl-v1.40.pre/dorade_to_radar.c rsl-v1.40/dorade_to_radar.c
+--- rsl-v1.40.pre/dorade_to_radar.c    2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/dorade_to_radar.c        2009-05-14 10:27:13.000000000 +0000
+@@ -97,7 +97,7 @@
+         return radar;
+     }
+-  fp = uncompress_pipe(fp); /* Transparently, use gunzip. */
++  fp = gunzip_pipe(fp); /* Transparently, use gunzip. */
+   /**********************************************************************/
+diff -ru rsl-v1.40.pre/gzip.c rsl-v1.40/gzip.c
+--- rsl-v1.40.pre/gzip.c       2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/gzip.c   2009-05-14 10:28:40.000000000 +0000
+@@ -32,8 +32,8 @@
+ /* Prototype definitions within this file. */
+ int no_command (char *cmd);
+-FILE *uncompress_pipe (FILE *fp);
+-FILE *compress_pipe (FILE *fp);
++FILE *gunzip_pipe (FILE *fp);
++FILE *gzip_pipe (FILE *fp);
+ /* Avoids the 'Broken pipe' message by reading the rest of the stream. */
+@@ -67,7 +67,7 @@
+   else return !0;
+ }
+-FILE *uncompress_pipe (FILE *fp)
++FILE *gunzip_pipe (FILE *fp)
+ {
+   /* Pass the file pointed to by 'fp' through the gzip pipe. */
+@@ -80,13 +80,13 @@
+   dup(fileno(fp));
+   fpipe = popen("gzip -q -d -f --stdout", "r");
+-  if (fpipe == NULL) perror("uncompress_pipe");
++  if (fpipe == NULL) perror("gunzip_pipe");
+   close(0);
+   dup(save_fd);
+   return fpipe;
+ }
+-FILE *compress_pipe (FILE *fp)
++FILE *gzip_pipe (FILE *fp)
+ {
+   /* Pass the file pointed to by 'fp' through the gzip pipe. */
+@@ -100,7 +100,7 @@
+   dup(fileno(fp));
+   fpipe = popen("gzip -q -1 -c", "w");
+-  if (fpipe == NULL) perror("compress_pipe");
++  if (fpipe == NULL) perror("gzip_pipe");
+   close(1);
+   dup(save_fd);
+   return fpipe;
+diff -ru rsl-v1.40.pre/lassen_to_radar.c rsl-v1.40/lassen_to_radar.c
+--- rsl-v1.40.pre/lassen_to_radar.c    2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/lassen_to_radar.c        2009-05-14 10:27:13.000000000 +0000
+@@ -285,7 +285,7 @@
+         perror(infile);
+         return NULL;
+     }
+-  f = uncompress_pipe(f); /* Transparently, use gunzip. */
++  f = gunzip_pipe(f); /* Transparently, use gunzip. */
+ #define NEW_BUFSIZ 16384
+   setvbuf(f,NULL,_IOFBF,(size_t)NEW_BUFSIZ); /* Faster i/o? */
+   
+diff -ru rsl-v1.40.pre/mcgill.c rsl-v1.40/mcgill.c
+--- rsl-v1.40.pre/mcgill.c     2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/mcgill.c 2009-05-14 10:27:13.000000000 +0000
+@@ -97,7 +97,7 @@
+    120, 120, 120, 120
+    };
+-FILE *uncompress_pipe (FILE *fp);
++FILE *gunzip_pipe (FILE *fp);
+ /**********************************************************************/
+ mcgFile_t *mcgFileOpen(int *code, char *filename)
+@@ -131,7 +131,7 @@
+         *code = MCG_OPEN_FILE_ERR;
+         return(NULL);
+         }
+-   file->fp = uncompress_pipe(file->fp); /* Transparently, use gunzip. */
++   file->fp = gunzip_pipe(file->fp); /* Transparently, use gunzip. */
+    /* Read first (header) record from data file into buffer */
+    if (fread(buffer, sizeof(char), MCG_RECORD, file->fp) < MCG_RECORD)
+         {
+diff -ru rsl-v1.40.pre/nsig.c rsl-v1.40/nsig.c
+--- rsl-v1.40.pre/nsig.c       2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/nsig.c   2009-05-14 10:27:13.000000000 +0000
+@@ -52,7 +52,7 @@
+ #include "nsig.h"
+-FILE *uncompress_pipe(FILE *fp);
++FILE *gunzip_pipe(FILE *fp);
+ int big_endian(void);
+ int little_endian(void);
+ void swap_4_bytes(void *word);
+@@ -76,7 +76,7 @@
+       return fp;
+   }
+-  fp = uncompress_pipe(fp); /* Transparently gunzip. */
++  fp = gunzip_pipe(fp); /* Transparently gunzip. */
+   return fp;
+ }
+diff -ru rsl-v1.40.pre/radar_to_uf.c rsl-v1.40/radar_to_uf.c
+--- rsl-v1.40.pre/radar_to_uf.c        2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/radar_to_uf.c    2009-05-14 10:27:13.000000000 +0000
+@@ -533,7 +533,7 @@
+       return;
+   }
+-  fp = compress_pipe(fp);
++  fp = gzip_pipe(fp);
+   RSL_radar_to_uf_fp(r, fp);
+   rsl_pclose(fp);
+ }
+diff -ru rsl-v1.40.pre/rainbow_to_radar.c rsl-v1.40/rainbow_to_radar.c
+--- rsl-v1.40.pre/rainbow_to_radar.c   2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/rainbow_to_radar.c       2009-05-14 10:27:13.000000000 +0000
+@@ -88,7 +88,7 @@
+       perror(infile);
+       return NULL;
+     }
+-    fp = uncompress_pipe(fp); /* Transparently gunzip. */
++    fp = gunzip_pipe(fp); /* Transparently gunzip. */
+     /* Read first character and verify file format. */
+diff -ru rsl-v1.40.pre/rapic_to_radar.c rsl-v1.40/rapic_to_radar.c
+--- rsl-v1.40.pre/rapic_to_radar.c     2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/rapic_to_radar.c 2009-05-14 10:27:13.000000000 +0000
+@@ -22,7 +22,7 @@
+         return radar;
+       }
+   }
+-  fp = uncompress_pipe(fp); /* Transparently gunzip. */
++  fp = gunzip_pipe(fp); /* Transparently gunzip. */
+   close(0); dup(fileno(fp)); /* Redirect stdin. */
+   rapicparse();
+diff -ru rsl-v1.40.pre/read_write.c rsl-v1.40/read_write.c
+--- rsl-v1.40.pre/read_write.c 2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/read_write.c     2009-05-14 10:27:13.000000000 +0000
+@@ -189,7 +189,7 @@
+       perror(infile);
+       return NULL;
+   }
+-  fp = uncompress_pipe(fp);
++  fp = gunzip_pipe(fp);
+   (void)fread(title, sizeof(char), sizeof(title), fp);
+   if (strncmp(title, "RSL", 3) != 0) return NULL;
+@@ -372,7 +372,7 @@
+       perror(outfile);
+       return -1;
+   }
+-  fp = compress_pipe(fp);
++  fp = gzip_pipe(fp);
+   n = RSL_write_radar_fp(radar, fp);
+   rsl_pclose(fp);
+diff -ru rsl-v1.40.pre/rsl.h rsl-v1.40/rsl.h
+--- rsl-v1.40.pre/rsl.h        2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/rsl.h    2009-05-14 10:27:13.000000000 +0000
+@@ -697,8 +697,10 @@
+ Histogram *RSL_read_histogram(char *infile);
+ int no_command (char *cmd);
+-FILE *uncompress_pipe (FILE *fp);
+-FILE *compress_pipe (FILE *fp);
++FILE *gunzip_pipe (FILE *fp);
++FILE *gzip_pipe (FILE *fp);
++FILE *bunzip2_pipe (FILE *fp);
++FILE *bzip2_pipe (FILE *fp);
+ int rsl_pclose(FILE *fp);
+ /* Carpi image generation functions. These are modified clones of the
+diff -ru rsl-v1.40.pre/toga.c rsl-v1.40/toga.c
+--- rsl-v1.40.pre/toga.c       2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/toga.c   2009-05-14 10:27:13.000000000 +0000
+@@ -84,7 +84,7 @@
+ int tg_read_ray(tg_file_str *);
+ void tg_prt_head(tg_map_head_str *,int);
+-FILE *uncompress_pipe (FILE *fp);
++FILE *gunzip_pipe (FILE *fp);
+ int tg_open(char *filename,tg_file_str *tg_file)
+@@ -102,7 +102,7 @@
+    /* Unfortunately, there is no tg_close to modularize the following
+     * pipe close.  Shouldn't be any problems anyway.
+     */
+-   (void) uncompress_pipe(fdopen(tg_file->fd, "r")); /* Redirect through gunzip. */
++   (void) gunzip_pipe(fdopen(tg_file->fd, "r")); /* Redirect through gunzip. */
+    /* initialize buffer pointers, flags */
+    tg_file->buf_ind = 32769;
+    tg_file->buf_end = 32769;
+diff -ru rsl-v1.40.pre/uf_to_radar.c rsl-v1.40/uf_to_radar.c
+--- rsl-v1.40.pre/uf_to_radar.c        2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/uf_to_radar.c    2009-05-14 10:27:13.000000000 +0000
+@@ -625,7 +625,7 @@
+       perror(infile);
+       return radar;
+   }
+-  fp = uncompress_pipe(fp); /* Transparently gunzip. */
++  fp = gunzip_pipe(fp); /* Transparently gunzip. */
+   radar = RSL_uf_to_radar_fp(fp);
+   rsl_pclose(fp);
+       
+diff -ru rsl-v1.40.pre/wsr88d.c rsl-v1.40/wsr88d.c
+--- rsl-v1.40.pre/wsr88d.c     2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/wsr88d.c 2009-05-14 10:27:13.000000000 +0000
+@@ -246,7 +246,7 @@
+   }
+   if (wf->fptr == NULL) return NULL;
+-  wf->fptr = uncompress_pipe(wf->fptr);
++  wf->fptr = gunzip_pipe(wf->fptr);
+ #define NEW_BUFSIZ 16384
+   setvbuf(wf->fptr,NULL,_IOFBF,(size_t)NEW_BUFSIZ); /* Faster i/o? */
+   return wf;
+diff -ru rsl-v1.40.pre/wsr88d.h rsl-v1.40/wsr88d.h
+--- rsl-v1.40.pre/wsr88d.h     2009-05-14 10:26:55.000000000 +0000
++++ rsl-v1.40/wsr88d.h 2009-05-14 10:27:13.000000000 +0000
+@@ -212,8 +212,8 @@
+ float wsr88d_get_frequency(Wsr88d_ray *ray);
+ int no_command (char *cmd);
+-FILE *uncompress_pipe (FILE *fp);
+-FILE *compress_pipe (FILE *fp);
++FILE *gunzip_pipe (FILE *fp);
++FILE *gzip_pipe (FILE *fp);
+ int rsl_pclose(FILE *fp);
+ #endif