summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--genimage.h2
-rw-r--r--image-hd.c8
-rw-r--r--util.c3
3 files changed, 7 insertions, 6 deletions
diff --git a/genimage.h b/genimage.h
index f4b203f..38103eb 100644
--- a/genimage.h
+++ b/genimage.h
@@ -159,7 +159,7 @@ int map_file_extents(struct image *image, const char *filename, int fd,
int is_block_device(const char *filename);
int pad_file(struct image *image, const char *infile,
size_t size, unsigned char fillpattern, enum pad_mode mode);
-int insert_data(struct image *image, const char *data, const char *outfile,
+int insert_data(struct image *image, const void *data, const char *outfile,
size_t size, long offset);
int extend_file(struct image *image, size_t size);
int reload_partitions(struct image *image);
diff --git a/image-hd.c b/image-hd.c
index b4f06b7..ef14fac 100644
--- a/image-hd.c
+++ b/image-hd.c
@@ -339,12 +339,12 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions)
header.table_crc = htole32(crc32(table, sizeof(table)));
header.header_crc = htole32(crc32(&header, sizeof(header)));
- ret = insert_data(image, (char *)&header, outfile, sizeof(header), 512);
+ ret = insert_data(image, &header, outfile, sizeof(header), 512);
if (ret) {
image_error(image, "failed to write GPT\n");
return ret;
}
- ret = insert_data(image, (char *)&table, outfile, sizeof(table), hd->gpt_location);
+ ret = insert_data(image, &table, outfile, sizeof(table), hd->gpt_location);
if (ret) {
image_error(image, "failed to write GPT table\n");
return ret;
@@ -363,13 +363,13 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions)
header.backup_lba = htole64(1);
header.starting_lba = htole64(image->size/512 - GPT_SECTORS);
header.header_crc = htole32(crc32(&header, sizeof(header)));
- ret = insert_data(image, (char *)&table, outfile, sizeof(table),
+ ret = insert_data(image, &table, outfile, sizeof(table),
image->size - GPT_SECTORS*512);
if (ret) {
image_error(image, "failed to write backup GPT table\n");
return ret;
}
- ret = insert_data(image, (char *)&header, outfile, sizeof(header),
+ ret = insert_data(image, &header, outfile, sizeof(header),
image->size - 512);
if (ret) {
image_error(image, "failed to write backup GPT\n");
diff --git a/util.c b/util.c
index d1aebec..94b62d2 100644
--- a/util.c
+++ b/util.c
@@ -559,9 +559,10 @@ err_out:
return ret;
}
-int insert_data(struct image *image, const char *data, const char *outfile,
+int insert_data(struct image *image, const void *_data, const char *outfile,
size_t size, long offset)
{
+ const char *data = _data;
int outf = -1;
int now, r;
int ret = 0;