]> wimlib.net Git - wimlib/blobdiff - src/symlink.c
extract_wim_resource() refactor
[wimlib] / src / symlink.c
index b1c5b5d388b4703cf96c6b26d2af7d8dbdb00dbb..b90ebe5e41c067edb1c76eb14ac311cce39a4699 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "dentry.h"
-#include "io.h"
+#include "buffer_io.h"
 #include "lookup_table.h"
 #include "sha1.h"
 #include <errno.h>
@@ -124,34 +124,31 @@ out:
        return ret;
 }
 
-void *make_symlink_reparse_data_buf(const char *symlink_target, size_t *len_ret)
+static void *make_symlink_reparse_data_buf(const char *symlink_target,
+                                          size_t *len_ret)
 {
        size_t utf8_len = strlen(symlink_target);
        size_t utf16_len;
        char *name_utf16 = utf8_to_utf16(symlink_target, utf8_len, &utf16_len);
        if (!name_utf16)
                return NULL;
-       /*DEBUG("utf16_len = %zu", utf16_len);*/
+
        for (size_t i = 0; i < utf16_len / 2; i++)
                if (((u16*)name_utf16)[i] == cpu_to_le16('/'))
                        ((u16*)name_utf16)[i] = cpu_to_le16('\\');
-       size_t len = 12 + utf16_len * 2 + 4;
+       size_t len = 12 + utf16_len * 2;
        void *buf = MALLOC(len);
        if (!buf)
                goto out;
-       /* XXX Fix absolute paths */
 
        u8 *p = buf;
-       p = put_u16(p, utf16_len + 2); /* Substitute name offset */
+       p = put_u16(p, utf16_len); /* Substitute name offset */
        p = put_u16(p, utf16_len); /* Substitute name length */
        p = put_u16(p, 0); /* Print name offset */
        p = put_u16(p, utf16_len); /* Print name length */
-       p = put_u32(p, 1);
+       p = put_u32(p, 1); /* flags: 0 iff *full* target, including drive letter??? */
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
-       p = put_u16(p, 0);
        p = put_bytes(p, utf16_len, (const u8*)name_utf16);
-       p = put_u16(p, 0);
-       /*DEBUG("utf16_len = %zu, len = %zu", utf16_len, len);*/
        *len_ret = len;
 out:
        FREE(name_utf16);