From f5d26d6005ba759762bec8c7cd45a738e577a8a7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 17 May 2013 22:34:08 -0500 Subject: [PATCH 1/1] Misc. fixes --- src/header.c | 8 ++++---- src/lookup_table.c | 4 ++-- src/reparse.c | 2 +- src/unix_capture.c | 9 +++------ src/util.c | 8 ++++---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/header.c b/src/header.c index 0066d75a..5a665fc2 100644 --- a/src/header.c +++ b/src/header.c @@ -72,7 +72,7 @@ struct wim_header_disk { * the only supported value). */ u32 chunk_size; - /* Globally unique identifier for the WIM file. Basically bunch of + /* Globally unique identifier for the WIM file. Basically a bunch of * random bytes. */ u8 guid[WIM_GID_LEN]; @@ -102,9 +102,9 @@ struct wim_header_disk { u32 boot_idx; /* Location and size of the WIM's integrity table, or all zeroes if the - * WIM has no integrity table. */ - - /* Note the integrity_table_res_entry here is 4-byte aligned even though + * WIM has no integrity table. + * + * Note the integrity_table_res_entry here is 4-byte aligned even though * it would ordinarily be 8-byte aligned--- hence, the _packed_attribute * on the `struct wim_header_disk' is essential. */ struct resource_entry_disk integrity_table_res_entry; diff --git a/src/lookup_table.c b/src/lookup_table.c index 95708866..f3d8c537 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -355,10 +355,10 @@ struct wim_lookup_table_entry_disk { struct resource_entry_disk resource_entry; /* Which part of the split WIM this stream is in; indexed from 1. */ - u16 part_number; + le16 part_number; /* Reference count of this stream over all WIM images. */ - u32 refcnt; + le32 refcnt; /* SHA1 message digest of the uncompressed data of this stream, or * optionally all zeroes if this stream is of zero length. */ diff --git a/src/reparse.c b/src/reparse.c index 50591097..b097212a 100644 --- a/src/reparse.c +++ b/src/reparse.c @@ -186,7 +186,7 @@ parse_reparse_data(const u8 * restrict rpbuf, u16 rpbuflen, if (rpdata->rptag == WIM_IO_REPARSE_TAG_SYMLINK) { if (rpbuflen < 20) goto out_invalid; - rpdata->rpflags = le16_to_cpu(rpbuf_disk->symlink.rpflags); + rpdata->rpflags = le32_to_cpu(rpbuf_disk->symlink.rpflags); data = rpbuf_disk->symlink.data; } else { data = rpbuf_disk->junction.data; diff --git a/src/unix_capture.c b/src/unix_capture.c index eb3005d4..906920a8 100644 --- a/src/unix_capture.c +++ b/src/unix_capture.c @@ -145,12 +145,9 @@ unix_capture_symlink(struct wim_dentry **root_p, inode->i_attributes = FILE_ATTRIBUTE_REPARSE_POINT; inode->i_reparse_tag = WIM_IO_REPARSE_TAG_SYMLINK; - /* The idea here is to call readlink() to get the UNIX target of - * the symbolic link, then turn the target into a reparse point - * data buffer that contains a relative or absolute symbolic - * link (NOT a junction point or *full* path symbolic link with - * drive letter). - */ + /* The idea here is to call readlink() to get the UNIX target of the + * symbolic link, then turn the target into a reparse point data buffer + * that contains a relative or absolute symbolic link. */ deref_name_len = readlink(path, deref_name_buf, sizeof(deref_name_buf) - 1); if (deref_name_len >= 0) { diff --git a/src/util.c b/src/util.c index a0ed84d9..6b93e2a9 100644 --- a/src/util.c +++ b/src/util.c @@ -439,7 +439,7 @@ void * wimlib_calloc(size_t nmemb, size_t size) { size_t total_size = nmemb * size; - void *p = (*wimlib_malloc_func)(total_size); + void *p = MALLOC(total_size); if (p) p = memset(p, 0, total_size); return p; @@ -452,9 +452,9 @@ wimlib_strdup(const char *str) char *p; size = strlen(str); - p = (*wimlib_malloc_func)(size + 1); + p = MALLOC(size + 1); if (p) - memcpy(p, str, size + 1); + p = memcpy(p, str, size + 1); return p; } @@ -466,7 +466,7 @@ wimlib_wcsdup(const wchar_t *str) wchar_t *p; size = wcslen(str); - p = (*wimlib_malloc_func)((size + 1) * sizeof(wchar_t)); + p = MALLOC((size + 1) * sizeof(wchar_t)); if (p) p = wmemcpy(p, str, size + 1); return p; -- 2.43.0