]> Pileus Git - grits/blob - opt/rsl/rsl-valgrind.patch
Fix compiling plugins
[grits] / opt / rsl / rsl-valgrind.patch
1 diff -w -ru rsl-v1.40/wsr88d_m31.c rsl-v1.40.test/wsr88d_m31.c
2 --- rsl-v1.40/wsr88d_m31.c      2008-10-08 23:43:03.000000000 +0000
3 +++ rsl-v1.40.test/wsr88d_m31.c 2009-05-14 10:06:23.000000000 +0000
4 @@ -515,6 +515,7 @@
5      m1_ray.vol_cpat = vcp_data.vcp;
6      m1_ray.elev_num = ray_hdr.elev_num;
7      m1_ray.unam_rng = wsr88d_ray.unamb_rng;
8 +    m1_ray.nyq_vel  = wsr88d_ray.nyq_vel; // TODO: is this correct?
9      if (ray_hdr.azm_res != 1)
10         ray->h.beam_width = 1.0;
11      else ray->h.beam_width = 0.5;
12 @@ -603,6 +604,8 @@
13             radar->v[vol_index]->sweep[isweep]->ray[iray] = ray;
14             radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1;
15         }
16 +       free(wsr88d_ray.ref->data);
17 +       free(wsr88d_ray.ref);
18      }
19  
20      if (wsr88d_ray.ray_hdr.dbptr_vel > 0) {
21 @@ -628,6 +631,8 @@
22         wsr88d_load_ray_hdr(wsr88d_ray, ray);
23         radar->v[vol_index]->sweep[isweep]->ray[iray] = ray;
24         radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1;
25 +       free(wsr88d_ray.vel->data);
26 +       free(wsr88d_ray.vel);
27      }
28  
29      if (wsr88d_ray.ray_hdr.dbptr_sw > 0) {
30 @@ -653,6 +658,8 @@
31         wsr88d_load_ray_hdr(wsr88d_ray, ray);
32         radar->v[vol_index]->sweep[isweep]->ray[iray] = ray;
33         radar->v[vol_index]->sweep[isweep]->h.nrays = iray+1;
34 +       free(wsr88d_ray.sw->data);
35 +       free(wsr88d_ray.sw);
36      }
37  
38  }
39 @@ -706,15 +713,27 @@
40   * at the WSR-88D Radar Operations Center web site.
41   */
42  
43 -    n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr);
44 -
45 -    /* printf("msgtype = %d\n", msghdr.msg_type); */
46 -    msg_hdr_size = sizeof(Wsr88d_msg_hdr) - sizeof(msghdr.rpg);
47  
48  
49      radar = RSL_new_radar(MAX_RADAR_VOLUMES);
50      
51      while (! end_of_vos) {
52 +       /* Read current header */
53 +       n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr);
54 +       if (n < 1) {
55 +           fprintf(stderr,"Warning: load_wsr88d_m31_into_radar: ");
56 +           if (feof(wf->fptr) != 0) fprintf(stderr,
57 +                   "Unexpected end of file.\n");
58 +           else fprintf(stderr,"Failed reading msghdr.\n");
59 +           fprintf(stderr,"Current sweep number: %d\n"
60 +                   "Last ray read: %d\n", isweep+1, iray);
61 +           wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
62 +           return radar;
63 +       }
64 +
65 +       /* printf("msgtype = %d\n", msghdr.msg_type); */
66 +       msg_hdr_size = sizeof(Wsr88d_msg_hdr) - sizeof(msghdr.rpg);
67 +
68         if (msghdr.msg_type == 31) {
69             if (little_endian()) wsr88d_swap_m31_hdr(&msghdr);
70  
71 @@ -729,6 +748,18 @@
72             /* Load this ray into radar structure ray. */
73             wsr88d_load_ray_into_radar(wsr88d_ray, isweep, iray, radar);
74             iray++;
75 +
76 +           /* Check for end of sweep */
77 +           if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) {
78 +               wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
79 +               isweep++;
80 +               iray = 0;
81 +           }
82 +
83 +           if (wsr88d_ray.ray_hdr.radial_status == END_VOS) {
84 +               //wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
85 +               end_of_vos = 1;
86 +           }
87         }
88         else { /* msg_type not 31 */
89             n = fread(&non31_seg_remainder, sizeof(non31_seg_remainder), 1,
90 @@ -748,33 +779,11 @@
91                 radar->h.vcp = vcp_data.vcp;
92                 /* printf("VCP = %d\n", vcp_data.vcp); */
93             }
94 +           /* TODO: check for end of sweep/volume */
95         }
96  
97 -       /* Check for end of sweep */
98 -       if (wsr88d_ray.ray_hdr.radial_status == END_OF_ELEV) {
99 -           wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
100 -           isweep++;
101 -           iray = 0;
102 -       }
103 -
104 -       if (wsr88d_ray.ray_hdr.radial_status != END_VOS) {
105 -           n = fread(&msghdr, sizeof(Wsr88d_msg_hdr), 1, wf->fptr);
106 -           if (n < 1) {
107 -               fprintf(stderr,"Warning: load_wsr88d_m31_into_radar: ");
108 -               if (feof(wf->fptr) != 0) fprintf(stderr,
109 -                       "Unexpected end of file.\n");
110 -               else fprintf(stderr,"Failed reading msghdr.\n");
111 -               fprintf(stderr,"Current sweep number: %d\n"
112 -                       "Last ray read: %d\n", isweep+1, iray);
113 -               wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
114 -               return radar;
115 -           }
116 -       }
117 -       else {
118 +       if (feof(wf->fptr) != 0)
119             end_of_vos = 1;
120 -           wsr88d_load_sweep_header(radar, isweep, wsr88d_ray);
121 -       }
122 -       if (feof(wf->fptr) != 0) end_of_vos = 1;
123      }
124  
125      return radar;
126 diff -w -ru rsl-v1.40/wsr88d_to_radar.c rsl-v1.40.test/wsr88d_to_radar.c
127 --- rsl-v1.40/wsr88d_to_radar.c 2008-07-30 22:41:20.000000000 +0000
128 +++ rsl-v1.40.test/wsr88d_to_radar.c    2009-05-14 10:07:09.000000000 +0000
129 @@ -429,5 +429,6 @@
130         radar->h.lpulse = sitep->lpulse;
131                 
132    radar = RSL_prune_radar(radar);
133 +  free(sitep);
134    return radar;
135  }