first cut at turnon scripts for EasyTimer v2
[fw/altos] / ao-tools / lib / ao-hex.c
index 2ceed7ab4f2ba9e1791c3283e23b735e93a2aaea..c275baafb2c296b41c011f7872c3c1d4d34330f0 100644 (file)
@@ -113,9 +113,9 @@ ao_hex_read_record(struct ao_hex_input *input)
        struct ao_hex_record *record = NULL;
        enum ao_hex_read_state state = read_marker;
        char c;
-       int nhexbytes;
-       uint32_t hex;
-       uint32_t ndata;
+       int nhexbytes = 0;
+       uint32_t hex = 0;
+       uint32_t ndata = 0;
        uint8_t checksum;
 
        while (state != read_done) {
@@ -451,8 +451,8 @@ ao_hex_image_free(struct ao_hex_image *image)
        free(image);
 }
 
-uint32_t min(uint32_t a, uint32_t b) { return a < b ? a : b; }
-uint32_t max(uint32_t a, uint32_t b) { return a > b ? a : b; }
+static uint32_t min(uint32_t a, uint32_t b) { return a < b ? a : b; }
+static uint32_t max(uint32_t a, uint32_t b) { return a > b ? a : b; }
 
 struct ao_hex_image *
 ao_hex_image_cat(struct ao_hex_image *a, struct ao_hex_image *b)
@@ -565,7 +565,7 @@ ao_hex_file_create(struct ao_hex_image *image, struct ao_sym *symbols, int num_s
 
        /* Stick an EOF after the data
         */
-       record = calloc(sizeof (struct ao_hex_record), 1);
+       record = calloc(1,sizeof (struct ao_hex_record) + 2);
        record->type = AO_HEX_RECORD_EOF;
        record->address = 0;
        record->length = 0;