]> wimlib.net Git - wimlib/blobdiff - src/hardlink.c
Comments
[wimlib] / src / hardlink.c
index 20faa555c9ea21c5a1c0e17b7dd2fea3e2efd9dc..c5324e74ec6c9e9921049c1d3ffcc8c6bc490d2a 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ * hardlink.c
+ *
+ * Code to deal with hard links in WIMs.  Essentially, the WIM dentries are put
+ * into a hash table indexed by the hard link group ID field, then for each hard
+ * link group, a linked list is made to connect the dentries.
+ */
+
+/*
+ * Copyright (C) 2012 Eric Biggers
+ *
+ * This file is part of wimlib, a library for working with WIM files.
+ *
+ * wimlib is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ */
+
 #include "wimlib_internal.h"
 #include "dentry.h"
 #include "list.h"
@@ -59,8 +86,9 @@ err:
  * we keep a linked list of the single dentries, and assign them hard link group
  * IDs later.
  */
-int link_group_table_insert(struct dentry *dentry, struct link_group_table *table)
+int link_group_table_insert(struct dentry *dentry, void *__table)
 {
+       struct link_group_table *table = __table;
        size_t pos;
        struct link_group *group;
 
@@ -200,9 +228,8 @@ static bool dentries_have_same_ads(const struct dentry *d1,
                if (strcmp(d1->ads_entries[i].stream_name_utf8,
                           d2->ads_entries[i].stream_name_utf8) != 0)
                        return false;
-               if (memcmp(d1->ads_entries[i].hash,
-                          d2->ads_entries[i].hash,
-                          WIM_HASH_SIZE) != 0)
+               if (!hashes_equal(d1->ads_entries[i].hash,
+                                 d2->ads_entries[i].hash))
                        return false;
        }
        return true;
@@ -227,7 +254,7 @@ static int share_dentry_ads(struct dentry *owner, struct dentry *user)
                mismatch_type = "security ID";
                goto mismatch;
        }
-       if (memcmp(owner->hash, user->hash, WIM_HASH_SIZE) != 0) {
+       if (!hashes_equal(owner->hash, user->hash)) {
                mismatch_type = "main file resource";
                goto mismatch;
        }