]> Pileus Git - ~andy/rsl/blobdiff - radar_to_uf.c
Support 2 byte data
[~andy/rsl] / radar_to_uf.c
index df237f57825888b138bcdebdef363988554904c0..5b7e499b891421dc628cf535631b35151a4def81 100644 (file)
@@ -320,7 +320,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;
@@ -498,11 +498,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) */
     }
   }