]> wimlib.net Git - wimlib/blobdiff - src/delete_image.c
Win32: Fix reparse point fixup bugs
[wimlib] / src / delete_image.c
index c95819e980d787ecd0d3996176f5e1688bf9f65a..862fb66e53e2efb1f0623aef17ce894d8c746f0f 100644 (file)
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
-#include "wimlib_internal.h"
-#include "xml.h"
-#include <string.h>
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "wimlib.h"
+#include "wimlib/error.h"
+#include "wimlib/metadata.h"
+#include "wimlib/util.h"
+#include "wimlib/wim.h"
+#include "wimlib/xml.h"
 
 /*
  * Deletes an image from the WIM.
@@ -69,9 +76,8 @@ wimlib_delete_image(WIMStruct *w, int image)
                put_image_metadata(w->image_metadata[image - 1], w->lookup_table);
 
                /* Get rid of the empty slot in the image metadata array. */
-               memmove(w->image_metadata[image - 1],
-                       &w->image_metadata[image],
-                       (w->hdr.image_count - image) * sizeof(w->image_metadata[0]));
+               for (int i = image - 1; i < w->hdr.image_count - 1; i++)
+                       w->image_metadata[i] = w->image_metadata[i + 1];
 
                /* Decrement the image count. */
                --w->hdr.image_count;