]> wimlib.net Git - wimlib/blobdiff - src/blob_table.c
Fix various typos
[wimlib] / src / blob_table.c
index 40c4af4bd023281157a4a653609c99ead554f961..96290e8de777afef6137f0e4d45433d5823e6e67 100644 (file)
@@ -403,7 +403,12 @@ cmp_blobs_by_sequential_order(const void *p1, const void *p2)
 
        v = (int)blob1->blob_location - (int)blob2->blob_location;
 
-       /* Different locations?  */
+       /* Different locations?  Note: "unsafe compaction mode" requires that
+        * blobs in WIMs sort before all others.  For the logic here to ensure
+        * this, BLOB_IN_WIM must have the lowest value among all defined
+        * blob_locations.  Statically verify that the enum values haven't
+        * changed.  */
+       STATIC_ASSERT(BLOB_NONEXISTENT == 0 && BLOB_IN_WIM == 1);
        if (v)
                return v;
 
@@ -415,6 +420,12 @@ cmp_blobs_by_sequential_order(const void *p1, const void *p2)
                /* Different WIM files?  */
                if (wim1 != wim2) {
 
+                       /* Resources from the WIM file currently being compacted
+                        * (if any) must always sort first.  */
+                       v = (int)wim2->being_compacted - (int)wim1->being_compacted;
+                       if (v)
+                               return v;
+
                        /* Different split WIMs?  */
                        v = cmp_guids(wim1->hdr.guid, wim2->hdr.guid);
                        if (v)