Fix void** casts
authorEric Biggers <ebiggers3@gmail.com>
Fri, 16 Aug 2013 23:52:35 +0000 (18:52 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 16 Aug 2013 23:52:55 +0000 (18:52 -0500)
src/integrity.c
src/lookup_table.c
src/metadata_resource.c
src/xml.c

index 1eeb671..7502b6d 100644 (file)
@@ -110,6 +110,7 @@ static int
 read_integrity_table(WIMStruct *wim, u64 num_checked_bytes,
                     struct integrity_table **table_ret)
 {
+       void *buf;
        struct integrity_table *table;
        int ret;
 
@@ -120,9 +121,10 @@ read_integrity_table(WIMStruct *wim, u64 num_checked_bytes,
              "original_size %"PRIu64")",
              wim->hdr.integrity.offset, wim->hdr.integrity.original_size);
 
-       ret = res_entry_to_data(&wim->hdr.integrity, wim, (void**)&table);
+       ret = res_entry_to_data(&wim->hdr.integrity, wim, &buf);
        if (ret)
                return ret;
+       table = buf;
 
        table->size        = le32_to_cpu(table->size);
        table->num_entries = le32_to_cpu(table->num_entries);
index 7441932..fee0f24 100644 (file)
@@ -484,7 +484,7 @@ read_wim_lookup_table(WIMStruct *wim)
        size_t num_entries;
        struct wim_lookup_table *table;
        struct wim_lookup_table_entry *cur_entry, *duplicate_entry;
-       struct wim_lookup_table_entry_disk *buf;
+       void *buf;
 
        BUILD_BUG_ON(sizeof(struct wim_lookup_table_entry_disk) !=
                     WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE);
@@ -499,8 +499,7 @@ read_wim_lookup_table(WIMStruct *wim)
 
 
        /* Read the lookup table into a buffer.  */
-       ret = res_entry_to_data(&wim->hdr.lookup_table_res_entry, wim,
-                               (void**)&buf);
+       ret = res_entry_to_data(&wim->hdr.lookup_table_res_entry, wim, &buf);
        if (ret)
                goto out;
 
@@ -516,7 +515,8 @@ read_wim_lookup_table(WIMStruct *wim)
         * on-disk lookup table.  */
        wim->current_image = 0;
        for (i = 0; i < num_entries; i++) {
-               const struct wim_lookup_table_entry_disk *disk_entry = &buf[i];
+               const struct wim_lookup_table_entry_disk *disk_entry =
+                       &((const struct wim_lookup_table_entry_disk*)buf)[i];
 
                cur_entry = new_lookup_table_entry();
                if (!cur_entry) {
index ac3b81b..e632198 100644 (file)
@@ -61,7 +61,7 @@
 int
 read_metadata_resource(WIMStruct *wim, struct wim_image_metadata *imd)
 {
-       u8 *buf;
+       void *buf;
        int ret;
        struct wim_dentry *root;
        const struct wim_lookup_table_entry *metadata_lte;
@@ -90,7 +90,7 @@ read_metadata_resource(WIMStruct *wim, struct wim_image_metadata *imd)
        }
 
        /* Read the metadata resource into memory.  (It may be compressed.) */
-       ret = read_full_resource_into_alloc_buf(metadata_lte, (void**)&buf);
+       ret = read_full_resource_into_alloc_buf(metadata_lte, &buf);
        if (ret)
                return ret;
 
index 419dfd8..cd98a79 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1276,6 +1276,7 @@ libxml_global_cleanup(void)
 int
 read_wim_xml_data(WIMStruct *wim)
 {
+       void *buf;
        u8 *xml_data;
        xmlDoc *doc;
        xmlNode *root;
@@ -1287,9 +1288,10 @@ read_wim_xml_data(WIMStruct *wim)
        DEBUG("Reading XML data: %"PRIu64" bytes at offset %"PRIu64"",
              (u64)res_entry->size, res_entry->offset);
 
-       ret = res_entry_to_data(res_entry, wim, (void**)&xml_data);
+       ret = res_entry_to_data(res_entry, wim, &buf);
        if (ret)
                goto out;
+       xml_data = buf;
 
        doc = xmlReadMemory((const char *)xml_data, res_entry->original_size,
                            NULL, "UTF-16LE", 0);