]> Pileus Git - ~andy/rsl/blobdiff - src/radar_to_uf.c
Merge branch 'master' into aweather
[~andy/rsl] / src / radar_to_uf.c
similarity index 97%
rename from radar_to_uf.c
rename to src/radar_to_uf.c
index e281486ef5bc388d62b3ee243386cb8b581d8ac3..f5a18abf3821d494808486cfbf8c3ce89cca5021 100644 (file)
@@ -211,9 +211,10 @@ void RSL_radar_to_uf_fp(Radar *r, FILE *fp)
     ray_num = 0;
   if (radar_verbose_flag) 
     fprintf(stderr,"Processing sweep %d for %d rays.", i, nrays);
-  if (radar_verbose_flag)
+  if (radar_verbose_flag) {
     if (little_endian()) fprintf(stderr," ... On Little endian.\n");
     else fprintf(stderr,"\n");
+  }
 
 
 /* Now LOOP for all rays within this particular sweep (i).
@@ -321,7 +322,7 @@ void RSL_radar_to_uf_fp(Radar *r, FILE *fp)
         uf_ma[37] = tm->tm_year % 100; /* Same format as data year */
         uf_ma[38] = tm->tm_mon+1;
         uf_ma[39] = tm->tm_mday;
-        memcpy(&uf_ma[40], "RSL" RSL_VERSION_STR, 8);
+        memcpy(&uf_ma[40], "RSL" VERSION, 8);
         if (little_endian()) swap2(&uf_ma[40], 8/2);
         uf_ma[44] = (signed short)UF_NO_DATA;
         len_ma = 45;
@@ -499,11 +500,16 @@ void RSL_radar_to_uf_fp(Radar *r, FILE *fp)
         rec_len =(int)uf_ma[1]*2;
         save_rec_len = rec_len;  /* We destroy 'rec_len' when making it
                         big endian on a little endian machine. */
-        if (little_endian()) swap_4_bytes(&rec_len);
-        (void)fwrite(&rec_len, sizeof(int), 1, fp);
-        if (little_endian()) swap_uf_buffer(uf);
-        (void)fwrite(uf, sizeof(char), save_rec_len, fp);
-        (void)fwrite(&rec_len, sizeof(int), 1, fp);
+       if (little_endian())
+           swap_4_bytes(&rec_len);
+       if (fwrite(&rec_len, sizeof(int), 1, fp) != 1)
+           perror("RSL_radar_to_uf_fp: short write");
+       if (little_endian())
+           swap_uf_buffer(uf);
+       if (fwrite(uf, sizeof(char), save_rec_len, fp) != 1)
+           perror("RSL_radar_to_uf_fp: short write");
+       if (fwrite(&rec_len, sizeof(int), 1, fp) != 1)
+           perror("RSL_radar_to_uf_fp: short write");
       } /* if (ray) */
     }
   }