diff options
Diffstat (limited to 'src/lg-downloader.c')
-rw-r--r-- | src/lg-downloader.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/lg-downloader.c b/src/lg-downloader.c index 5c3ecfc..c41ebd0 100644 --- a/src/lg-downloader.c +++ b/src/lg-downloader.c @@ -17,8 +17,10 @@ #include <stdlib.h> #include <stdio.h> +#include <stdint.h> #include <string.h> #include <fcntl.h> +#include <sys/types.h> #include <sys/stat.h> #include "lg-downloader.h" @@ -101,7 +103,7 @@ int erase(struct context *context) } if (context->verbose) - printf("Erasing partition with address %d blocks and length %d bytes\n", context->address, context->length); + printf("Erasing partition with address %d blocks and length %d bytes\n", (int) context->address, (int) context->length); rc = download_erase(context, context->address, context->length); if (rc < 0) @@ -113,12 +115,12 @@ int erase(struct context *context) int flash(struct context *context) { void *buffer = NULL; - unsigned int address; - unsigned int length; - unsigned int count; - unsigned int chunk; - unsigned char *p; - unsigned int i; + off_t address; + size_t length; + size_t count; + size_t chunk; + uint8_t *p; + size_t i; struct stat st; int fd = -1; int rc; @@ -141,7 +143,7 @@ int flash(struct context *context) length = st.st_size; if (length > context->length) { - fprintf(stderr, "File size (%d bytes) is too big for partition (%d bytes)\n", length, context->length); + fprintf(stderr, "File size (%d bytes) is too big for partition (%d bytes)\n", (int) length, (int) context->length); goto error; } @@ -152,7 +154,7 @@ int flash(struct context *context) } if (context->verbose) - printf("Writing to partition with address %d blocks and length %d bytes\n", context->address, length); + printf("Writing to partition with address %d blocks and length %d bytes\n", (int) context->address, (int) length); buffer = calloc(1, GPT_BLOCK_SIZE); @@ -174,7 +176,7 @@ int flash(struct context *context) if (chunk < GPT_BLOCK_SIZE) memset(buffer, 0, GPT_BLOCK_SIZE); - p = (unsigned char *) buffer; + p = (uint8_t *) buffer; i = 0; while (i < chunk) { @@ -213,12 +215,12 @@ complete: int dump(struct context *context) { void *buffer = NULL; - unsigned int address; - unsigned int length; - unsigned int count; - unsigned int chunk; - unsigned char *p; - unsigned int c; + off_t address; + size_t length; + size_t count; + size_t chunk; + uint8_t *p; + size_t c; int fd = -1; int rc; @@ -238,7 +240,7 @@ int dump(struct context *context) } if (context->verbose) - printf("Dumping partition with address %d blocks and length %d bytes\n", context->address, context->length); + printf("Dumping partition with address %d blocks and length %d bytes\n", (int) context->address, (int) context->length); buffer = calloc(1, GPT_BLOCK_SIZE); @@ -264,7 +266,7 @@ int dump(struct context *context) goto error; c = 0; - p = (unsigned char *) buffer; + p = (uint8_t *) buffer; while (c < chunk) { rc = write(fd, p, chunk - c); |