]> wimlib.net Git - wimlib/blobdiff - src/split.c
Alignment between dentry and ADS entries...
[wimlib] / src / split.c
index 0321492e7d7cfddc49aec925ba695859039dfaa3..40c861a1a356efb5276caacb7f7bdaea3b00af85 100644 (file)
@@ -49,7 +49,7 @@ static int finish_swm(WIMStruct *w, struct lookup_table_entry *lte_chain_head,
        off_t lookup_table_offset = ftello(w->out_fp);
        int ret;
 
-       DEBUG("Writing lookup table for SWM (offset %"PRIu64")\n", 
+       DEBUG("Writing lookup table for SWM (offset %"PRIu64")", 
                        lookup_table_offset);
 
        while (lte_chain_head != NULL) {
@@ -82,7 +82,6 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args)
 {
        struct args *args = (struct args*)__args;
        WIMStruct *w = args->w;
-       FILE *out_fp = w->out_fp;
        int ret;
 
        /* metadata resources were already written. */
@@ -108,12 +107,12 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args)
 
                if (args->write_flags & WIMLIB_OPEN_FLAG_SHOW_PROGRESS)
                        printf("Writing `%s' (%"PRIu64" of %"PRIu64" bytes, "
-                                       "%.0f%% done)\n", 
-                               args->swm_base_name, 
-                               args->total_bytes_written,
-                               args->total_bytes,
-                               (double)args->total_bytes_written /
-                                       (double)args->total_bytes * 100.0);
+                              "%.0f%% done)\n", 
+                              args->swm_base_name, 
+                              args->total_bytes_written,
+                              args->total_bytes,
+                              (double)args->total_bytes_written /
+                                  (double)args->total_bytes * 100.0);
 
                ret = begin_write(w, args->swm_base_name, args->write_flags);
                if (ret != 0)
@@ -188,7 +187,7 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name,
 
                struct lookup_table_entry *metadata_lte;
 
-               metadata_lte = w->image_metadata[i].lookup_table_entry;
+               metadata_lte = w->image_metadata[i].metadata_lte;
                ret = copy_resource(metadata_lte, w);
                if (ret != 0)
                        return ret;
@@ -241,22 +240,23 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name,
 
                FILE *fp = fopen(p, "r+b");
                if (!fp) {
-                       ERROR("Failed to open `%s': %m\n", p);
+                       ERROR_WITH_ERRNO("Failed to open `%s'", p);
                        return WIMLIB_ERR_OPEN;
                }
-               char buf[4];
-               put_u16(buf, i);
-               put_u16(buf + 2, total_parts);
+               u8 buf[4];
+               put_u16(&buf[0], i);
+               put_u16(&buf[2], total_parts);
 
                if (fseek(fp, 40, SEEK_SET) != 0 || 
                                fwrite(buf, 1, sizeof(buf), fp) != sizeof(buf)
                                || fclose(fp) != 0) {
-                       ERROR("Error overwriting header of `%s': %m\n", name);
+                       ERROR_WITH_ERRNO("Error overwriting header of `%s'",
+                                        name);
                        return WIMLIB_ERR_WRITE;
                }
        }
        if (write_flags & WIMLIB_OPEN_FLAG_SHOW_PROGRESS)
-               printf("Done!\n");
+               puts("Done!");
        wimlib_free(w);
        return 0;
 }