diff options
Diffstat (limited to 'tools/firmware-utils/src/mkcasfw.c')
-rw-r--r-- | tools/firmware-utils/src/mkcasfw.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/firmware-utils/src/mkcasfw.c b/tools/firmware-utils/src/mkcasfw.c index 904000c78d..0e7aa17c1b 100644 --- a/tools/firmware-utils/src/mkcasfw.c +++ b/tools/firmware-utils/src/mkcasfw.c @@ -463,8 +463,9 @@ csum8_get(struct csum_state *css) void -csum16_update(uint8_t *p, uint32_t len, struct csum_state *css) +csum16_update(void *data, uint32_t len, struct csum_state *css) { + uint8_t *p = data; uint16_t t; if (css->odd) { @@ -524,8 +525,10 @@ csum_init(struct csum_state *css, int size) } void -csum_update(uint8_t *p, uint32_t len, struct csum_state *css) +csum_update(void *data, uint32_t len, struct csum_state *css) { + uint8_t *p = data; + switch (css->size) { case CSUM_TYPE_8: csum8_update(p,len,css); @@ -568,19 +571,21 @@ csum_get(struct csum_state *css) * routines to write data to the output file */ int -write_out_data(FILE *outfile, uint8_t *data, size_t len, +write_out_data(FILE *outfile, void *data, size_t len, struct csum_state *css) { + uint8_t *ptr = data; + errno = 0; - fwrite(data, len, 1, outfile); + fwrite(ptr, len, 1, outfile); if (errno) { ERRS("unable to write output file"); return ERR_FATAL; } if (css) { - csum_update(data, len, css); + csum_update(ptr, len, css); } return 0; |