]> wimlib.net Git - wimlib/blobdiff - src/dentry.c
Initial rewrite of resource code
[wimlib] / src / dentry.c
index 677db1dbd77fdf48f47b87785316595879738ca7..2ed77da7ffaaed52f256a376049203b043de0a92 100644 (file)
@@ -638,7 +638,7 @@ print_dentry(struct wim_dentry *dentry, void *lookup_table)
                hash = inode_stream_hash(inode, 0);
                if (hash) {
                        tprintf(T("Hash              = 0x"));
-                       print_hash(hash);
+                       print_hash(hash, stdout);
                        tputchar(T('\n'));
                        tputchar(T('\n'));
                }
@@ -652,7 +652,7 @@ print_dentry(struct wim_dentry *dentry, void *lookup_table)
                hash = inode_stream_hash(inode, i + 1);
                if (hash) {
                        tprintf(T("Hash              = 0x"));
-                       print_hash(hash);
+                       print_hash(hash, stdout);
                        tputchar(T('\n'));
                }
                print_lookup_table_entry(inode_stream_lte(inode, i + 1, lookup_table),
@@ -669,7 +669,7 @@ dentry_common_init(struct wim_dentry *dentry)
        dentry->refcnt = 1;
 }
 
-static struct wim_inode *
+struct wim_inode *
 new_timeless_inode()
 {
        struct wim_inode *inode = CALLOC(1, sizeof(struct wim_inode));
@@ -781,7 +781,7 @@ init_ads_entry(struct wim_ads_entry *ads_entry, const void *name,
                ads_entry->stream_name = p;
                ads_entry->stream_name_nbytes = name_nbytes;
        } else {
-               if (name && *(const tchar*)name == T('\0')) {
+               if (name && *(const tchar*)name != T('\0')) {
                        ret = get_utf16le_name(name, &ads_entry->stream_name,
                                               &ads_entry->stream_name_nbytes);
                }
@@ -796,7 +796,8 @@ destroy_ads_entry(struct wim_ads_entry *ads_entry)
 }
 
 /* Frees an inode. */
-void free_inode(struct wim_inode *inode)
+void
+free_inode(struct wim_inode *inode)
 {
        if (inode) {
                if (inode->i_ads_entries) {
@@ -818,7 +819,8 @@ void free_inode(struct wim_inode *inode)
 
 /* Decrements link count on an inode and frees it if the link count reaches 0.
  * */
-static void put_inode(struct wim_inode *inode)
+static void
+put_inode(struct wim_inode *inode)
 {
        wimlib_assert(inode->i_nlink != 0);
        if (--inode->i_nlink == 0) {
@@ -836,7 +838,8 @@ static void put_inode(struct wim_inode *inode)
  * The corresponding inode (if any) is freed only if its link count is
  * decremented to 0.
  */
-void free_dentry(struct wim_dentry *dentry)
+void
+free_dentry(struct wim_dentry *dentry)
 {
        FREE(dentry->file_name);
        FREE(dentry->short_name);
@@ -846,7 +849,8 @@ void free_dentry(struct wim_dentry *dentry)
        FREE(dentry);
 }
 
-void put_dentry(struct wim_dentry *dentry)
+void
+put_dentry(struct wim_dentry *dentry)
 {
        wimlib_assert(dentry->refcnt != 0);
        if (--dentry->refcnt == 0)
@@ -855,7 +859,8 @@ void put_dentry(struct wim_dentry *dentry)
 
 /* This function is passed as an argument to for_dentry_in_tree_depth() in order
  * to free a directory tree. */
-static int do_free_dentry(struct wim_dentry *dentry, void *__lookup_table)
+static int
+do_free_dentry(struct wim_dentry *dentry, void *__lookup_table)
 {
        struct wim_lookup_table *lookup_table = __lookup_table;
        unsigned i;
@@ -884,13 +889,15 @@ static int do_free_dentry(struct wim_dentry *dentry, void *__lookup_table)
  *                     table entries corresponding to the dentries will be
  *                     decremented.
  */
-void free_dentry_tree(struct wim_dentry *root, struct wim_lookup_table *lookup_table)
+void
+free_dentry_tree(struct wim_dentry *root, struct wim_lookup_table *lookup_table)
 {
        if (root)
                for_dentry_in_tree_depth(root, do_free_dentry, lookup_table);
 }
 
-int increment_dentry_refcnt(struct wim_dentry *dentry, void *ignore)
+int
+increment_dentry_refcnt(struct wim_dentry *dentry, void *ignore)
 {
        dentry->refcnt++;
        return 0;
@@ -1151,7 +1158,7 @@ inode_get_unix_data(const struct wim_inode *inode,
        if (size != sizeof(struct wimlib_unix_data))
                return BAD_UNIX_DATA;
 
-       ret = read_full_wim_resource(lte, unix_data, 0);
+       ret = read_full_resource_into_buf(lte, unix_data, true);
        if (ret)
                return ret;