-Werror-implicit-function-declaration \
-fno-common -Wundef -Wno-pointer-sign
+if WINDOWS_NATIVE_BUILD
+# This option is needed to make packed structures work as expected
+# with gcc 4.7+ (mingw) on Windows.
+AM_CFLAGS += -mno-ms-bitfields
+endif
lib_LTLIBRARIES = libwim.la
utf16lechar stream_name[];
} _packed_attribute;
+#define WIM_ADS_ENTRY_DISK_SIZE 38
+
/* WIM directory entry (on-disk format) */
struct wim_dentry_on_disk {
le64 length;
/*utf16lechar short_name[];*/
} _packed_attribute;
+#define WIM_DENTRY_DISK_SIZE 102
+
/* Calculates the unaligned length, in bytes, of an on-disk WIM dentry that has
* a file name and short name that take the specified numbers of bytes. This
* excludes any alternate data stream entries that may follow the dentry. */
struct wim_ads_entry *ads_entries;
int ret;
+ BUILD_BUG_ON(sizeof(struct wim_ads_entry_on_disk) != WIM_ADS_ENTRY_DISK_SIZE);
+
/* Allocate an array for our in-memory representation of the alternate
* data stream entries. */
num_ads = inode->i_num_ads;
const struct wim_dentry_on_disk *disk_dentry =
(const struct wim_dentry_on_disk*)p;
+ BUILD_BUG_ON(sizeof(struct wim_dentry_on_disk) != WIM_DENTRY_DISK_SIZE);
+
if ((uintptr_t)p & 7)
WARNING("WIM dentry is not 8-byte aligned");
{
struct wim_header_disk disk_hdr _aligned_attribute(8);
+ BUILD_BUG_ON(sizeof(struct wim_header_disk) != WIM_HEADER_DISK_SIZE);
+
DEBUG("Reading WIM header from \"%"TS"\"", filename);
if (full_pread(in_fd, &disk_hdr, sizeof(disk_hdr), 0) != sizeof(disk_hdr)) {
return WIMLIB_ERR_NOT_A_WIM_FILE;
}
- BUILD_BUG_ON(sizeof(struct wim_header_disk) != WIM_HEADER_DISK_SIZE);
if (le32_to_cpu(disk_hdr.hdr_size) != sizeof(struct wim_header_disk)) {
ERROR("\"%"TS"\": Header size is invalid (%u bytes)",
filename, le32_to_cpu(disk_hdr.hdr_size));
u8 hash[SHA1_HASH_SIZE];
} _packed_attribute;
+#define WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE 50
+
/*
* Reads the lookup table from a WIM file.
*
struct wim_lookup_table_entry_disk
table_buf[BUFFER_SIZE / sizeof(struct wim_lookup_table_entry_disk)]
_aligned_attribute(8);
+
+ BUILD_BUG_ON(sizeof(struct wim_lookup_table_entry_disk) !=
+ WIM_LOOKUP_TABLE_ENTRY_DISK_SIZE);
+
off_t offset;
size_t buf_entries_remaining;
const struct wim_lookup_table_entry_disk *disk_entry;