]> wimlib.net Git - wimlib/blobdiff - src/xml.c
xml.c: Fix sort_by_index()
[wimlib] / src / xml.c
index a1e6f5960c736809230060ffc8644d50e619c3d3..65e34a2114db281b4f1af4f97fffb73177ec5f3d 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -185,8 +185,8 @@ static u64 node_get_timestamp(const xmlNode *time_node)
 /* Used to sort an array of struct image_infos by their image indices. */
 static int sort_by_index(const void *p1, const void *p2)
 {
-       int index_1 = ((struct image_info*)p1)->index;
-       int index_2 = ((struct image_info*)p1)->index;
+       int index_1 = ((const struct image_info*)p1)->index;
+       int index_2 = ((const struct image_info*)p2)->index;
        if (index_1 < index_2)
                return -1;
        else if (index_1 > index_2)
@@ -950,9 +950,6 @@ void xml_delete_image(struct wim_info **wim_info_p, int image)
 
        wim_info = *wim_info_p;
 
-       wimlib_assert(wim_info != NULL);
-       wimlib_assert(image >= 1 && image <= wim_info->num_images);
-
        destroy_image_info(&wim_info->images[image - 1]);
 
        memcpy(&wim_info->images[image - 1],