]> wimlib.net Git - wimlib/commitdiff
Remove more trailing whitespace
authorEric Biggers <ebiggers3@gmail.com>
Fri, 26 Oct 2012 21:35:32 +0000 (16:35 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 26 Oct 2012 21:35:32 +0000 (16:35 -0500)
39 files changed:
README
archlinux/PKGBUILD.in
configure.ac
debian/copyright
debian/rules
programs/imagex.c
src/dentry.h
src/endianness.h
src/extract.c
src/hardlink.c
src/header.c
src/integrity.c
src/join.c
src/lookup_table.c
src/lookup_table.h
src/lz.c
src/lzx-comp.c
src/lzx-decomp.c
src/lzx.h
src/modify.c
src/mount.c
src/ntfs-apply.c
src/ntfs-capture.c
src/resource.c
src/security.c
src/security.h
src/sha1.c
src/split.c
src/symlink.c
src/util.h
src/wimlib.h
src/wimlib_internal.h
src/write.c
src/xml.c
src/xml.h
src/xpress.h
tests/test-imagex
tests/test-imagex-ntfs
tests/tree-cmp.c

diff --git a/README b/README
index 5b7d5deb2de0bde00a9b6ea75818954dbdc58481..25726650e121288f992913fdb2c9704a5792002d 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-                                  WIMLIB                                    
+                                  WIMLIB
 
 This is wimlib version 1.0.4 (October 2012).  wimlib can be used to read,
 write, and mount files in the Windows Imaging Format (WIM files).  These
@@ -64,7 +64,7 @@ and then re-applied later.
                                    PROGRAMS
 
 wimlib provides a public API for other programs to use, but also comes with two
-programs: `imagex' and `mkwinpeimg'.  
+programs: `imagex' and `mkwinpeimg'.
 
 `imagex' is intended to be like the imagex.exe program from Windows.  `imagex'
 can be used to create, extract, and mount WIM files.  Both read-only and
@@ -186,7 +186,7 @@ wimlib's `configure' script:
        Removes all error messages from the library.  If left in, they still
        have to explicitly turned on with wimlib_set_print_errors() in order to
        see them.  Also, error codes will still be returned regardless of
-       whether error messages are printed or not.  
+       whether error messages are printed or not.
 
        If --disable-error-messages is given, wimlib_set_print_errors() will
        fail with WIMLIB_ERR_UNSUPPORTED if the action is to turn error messages
@@ -215,14 +215,14 @@ wimlib may work on FreeBSD.  However, this is not well tested.  If you do not
 have libntfs-3g 2011-4-12 or later available, you must configure with
 --without-ntfs-3g.  Also, GNU coreutils is needed to run the test suite.  Before
 mounting a WIM you need to load the POSIX message queue module (run `kldload
-mqueuefs').  
+mqueuefs').
 
 wimlib should work on big endian machines but it has not been tested.
 
 There are no plans to port wimlib to Windows since the programming interface on
 Windows is very different and Microsoft's imagex.exe is already available.
 
-                                  REFERENCES 
+                                  REFERENCES
 
 The WIM file format is specified in a document that can be found in the
 Microsoft Download Center.  There is a similar document that specifies the LZX
@@ -241,7 +241,7 @@ http://www.tuxera.com/community/ntfs-3g-download/ for more information.
 
 lzx-decomp.c, the code to decompress WIM file resources that are compressed
 using LZX compression, is originally based on code from the cabextract project
-(http://www.cabextract.org.uk).  
+(http://www.cabextract.org.uk).
 
 lzx-comp.c, the code to compress WIM file resources using LZX compression, is
 originally based on code written by Matthew Russotto (www.russotto.net/chm/).
@@ -258,9 +258,9 @@ ability to create LZX or XPRESS compressed WIMs.
 
 An earlier version of wimlib is being used to deploy Windows 7 from the Ultimate
 Deployment Appliance.  For more information see
-http://www.ultimatedeployment.org/.  
+http://www.ultimatedeployment.org/.
 
-You can see the documentation about Microsoft's version of the imagex program at 
+You can see the documentation about Microsoft's version of the imagex program at
 http://technet.microsoft.com/en-us/library/cc749447(v=ws.10).aspx, so you can
 see how it compares.
 
@@ -317,11 +317,11 @@ This includes the files in the `programs' directory as well as the files in the
 wimlib is independently developed and does not contain any code, data, or files
 copyrighted by Microsoft.  It is not known to be affected by any patents.
 
-                                  DISCLAIMER 
+                                  DISCLAIMER
 
 wimlib is experimental.  Use Microsoft's `imagex.exe' if you want to make sure
 your WIM files are made correctly (but beware: Microsoft's version contains some
-bugs).  
+bugs).
 
 Please submit a bug report (to ebiggers3@gmail.com) if you find a bug in wimlib.
 
index 6ac24420524f15095d85d5548d93c9978841b397..d137fbf16982d5f9c74992e75f179c8652133cca 100644 (file)
@@ -11,8 +11,8 @@ url="http://sourceforge.net/projects/wimlib"
 license=("GPL3")
 depends=("openssl" "fuse" "libxml2" "ntfs-3g" "attr")
 optdepends=("cdrkit: for making ISO image of Windows PE"
-       "mtools: for making disk image of Windows PE"   
-       "syslinux: for making disk image of Windows PE" 
+       "mtools: for making disk image of Windows PE"
+       "syslinux: for making disk image of Windows PE"
        "cabextract: for extracting Windows PE from the WAIK"
        "ntfsprogs: for making NTFS filesystems")
 checkdepends=("ntfsprogs")
@@ -26,12 +26,12 @@ build() {
 }
 
 check() {
-       cd "$pkgname-$pkgver"  
+       cd "$pkgname-$pkgver"
        make check
 }
 
 package() {
-       cd "$pkgname-$pkgver"  
+       cd "$pkgname-$pkgver"
        make DESTDIR="$pkgdir" install
 }
 
index 999608139a35f0e9ea6cc04bad6b89cc6536eb9a..6396002cd90d6e11a9654b26ca391579a0d47584 100644 (file)
@@ -7,7 +7,7 @@ AC_C_BIGENDIAN
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 LT_INIT
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([Makefile 
+AC_CONFIG_FILES([Makefile
                doc/Doxyfile
                wimlib.pc
                doc/imagex.1
@@ -60,46 +60,46 @@ AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
 
 AC_MSG_CHECKING([whether to include debugging messages])
-AC_ARG_ENABLE([debug], 
+AC_ARG_ENABLE([debug],
        AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
        [ENABLE_DEBUG=$enableval],
        [ENABLE_DEBUG=no]
        )
 AC_MSG_RESULT([$ENABLE_DEBUG])
 if test "x$ENABLE_DEBUG" = "xyes"; then
-       AC_DEFINE([ENABLE_DEBUG], [1], 
+       AC_DEFINE([ENABLE_DEBUG], [1],
                        [Define to 1 if including lots of debug messages.])
 fi
 
 AC_MSG_CHECKING([whether to include more debugging messages])
-AC_ARG_ENABLE([more_debug], 
-       AS_HELP_STRING([--enable-more-debug], 
+AC_ARG_ENABLE([more_debug],
+       AS_HELP_STRING([--enable-more-debug],
                        [include even more debugging messages]),
        [ENABLE_MORE_DEBUG=$enableval],
        [ENABLE_MORE_DEBUG=no]
        )
 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
-       AC_DEFINE([ENABLE_MORE_DEBUG], [1], 
+       AC_DEFINE([ENABLE_MORE_DEBUG], [1],
                        [Define to 1 if including even more debug messages.])
 fi
 
 AC_MSG_CHECKING([whether to include error messages])
-AC_ARG_ENABLE([error_messages], 
-       AS_HELP_STRING([--disable-error-messages], 
+AC_ARG_ENABLE([error_messages],
+       AS_HELP_STRING([--disable-error-messages],
                        [do not compile in error messsages]),
        [ENABLE_ERROR_MESSAGES=$enableval],
        [ENABLE_ERROR_MESSAGES=yes]
        )
 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
-       AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], 
+       AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
                        [Define to 1 if including error messages])
 fi
 
 AC_MSG_CHECKING([whether to support custom memory allocation functions])
-AC_ARG_ENABLE([custom_memory_allocator], 
-       AS_HELP_STRING([--disable-custom-memory-allocator], 
+AC_ARG_ENABLE([custom_memory_allocator],
+       AS_HELP_STRING([--disable-custom-memory-allocator],
                       [do not support the use of custom memory allocation
                        functions]),
        [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
@@ -107,7 +107,7 @@ AC_ARG_ENABLE([custom_memory_allocator],
        )
 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
-       AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1], 
+       AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
                [Define to 1 if supporting custom memory allocation functions])
 fi
 
@@ -153,7 +153,7 @@ if test "x$WITH_NTFS_3G" = "xyes"; then
 
        AC_CHECK_LIB([ntfs-3g], [ntfs_mount], [],
                        [AC_MSG_ERROR([Cannot find libntfs-3g.
-       Without libntfs-3g, wimlib cannot include support for capturing and 
+       Without libntfs-3g, wimlib cannot include support for capturing and
        applying WIMs on NTFS filesystems while preserving NTFS-specific data
        such as security descriptors and alternate data streams.  You should
        either install libntfs-3g, or configure with --without-ntfs-3g to
@@ -171,8 +171,8 @@ AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
 
 AC_MSG_CHECKING([whether to include support for mounting WIMs])
 AC_ARG_WITH([fuse],
-               AS_HELP_STRING([--without-fuse], [build without libfuse.  
-                                       This will disable the ability to mount 
+               AS_HELP_STRING([--without-fuse], [build without libfuse.
+                                       This will disable the ability to mount
                                        WIM files.]),
        [WITH_FUSE=$withval],
        [WITH_FUSE=yes]
@@ -183,7 +183,7 @@ if test "x$WITH_FUSE" = "xyes"; then
 
 
        AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
-                       [AC_MSG_ERROR([Cannot find libfuse.  
+                       [AC_MSG_ERROR([Cannot find libfuse.
        Without libfuse, wimlib cannot include support for mounting WIMs.  You
        should either install libfuse, or configure with --without-fuse to
        disable support for mounting WIMs.])
@@ -232,10 +232,10 @@ AC_ARG_ENABLE([ssse3-sha1],
        [ENABLE_SSSE3_SHA1=$enableval],
        [ENABLE_SSSE3_SHA1=no]
        )
-       
+
 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
-       AC_DEFINE([ENABLE_SSSE3_SHA1], [1], 
+       AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
                        [Define to 1 if using vectorized implementation of SHA1])
        SSSE3_SHA1_OBJ=sha1-ssse3.lo
        AX_PROG_NASM
@@ -253,7 +253,7 @@ else
                                        rather than use external libcrypto from
                                        OpenSSL (default is autodetect)]),
        [WITH_LIBCRYPTO=$withval],
-       [AC_CHECK_LIB([crypto], [SHA1], 
+       [AC_CHECK_LIB([crypto], [SHA1],
                     [WITH_LIBCRYPTO=yes],
                     [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
                     WITH_LIBCRYPTO=no
index 999c2267dfd046c301d6c4c301bf502661c4fc91..b0ab08b65bf2bb7ad33c8407805434f30a4e494e 100644 (file)
@@ -16,7 +16,7 @@ License: GPLv3+
 
  You should have received a copy of the GNU General Public License along with
  this library; if not, write to the Free Software Foundation, Inc., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307 USA 
+ Place, Suite 330, Boston, MA 02111-1307 USA
 
 Files: debian/*
 Copyright: 2012 Eric Biggers <ebiggers3@gmail.com>
index fcc2b6104dd64e8331eb15fae0c51d8d1a844c7f..f498a10b78c3c64ba24d1412d1eb78e791fbd387 100755 (executable)
@@ -10,4 +10,4 @@
 export DH_VERBOSE=1
 
 %:
-       dh $@ 
+       dh $@
index f79a07caafa8b6ff0278c9243386a3b3557390e1..b9bf29cfbb025d774513cf8cb63c0dd3fa0848c7 100644 (file)
@@ -61,44 +61,44 @@ static void usage(int cmd_type);
 static void usage_all();
 
 static const char *usage_strings[] = {
-[APPEND] = 
+[APPEND] =
 "    imagex append (DIRECTORY | NTFS_VOLUME) WIMFILE [IMAGE_NAME]\n"
 "                  [DESCRIPTION] [--boot] [--check] [--flags EDITION_ID]\n"
 "                  [--verbose] [--dereference] [--config=FILE]\n",
-[APPLY] = 
+[APPLY] =
 "    imagex apply WIMFILE [IMAGE_NUM | IMAGE_NAME | all]\n"
 "                 (DIRECTORY | NTFS_VOLUME) [--check] [--hardlink]\n"
 "                 [--symlink] [--verbose] [--ref=\"GLOB\"]\n",
-[CAPTURE] = 
+[CAPTURE] =
 "    imagex capture (DIRECTORY | NTFS_VOLUME) WIMFILE [IMAGE_NAME]\n"
 "                   [DESCRIPTION] [--boot] [--check] [--compress=TYPE]\n"
 "                   [--flags EDITION_ID] [--verbose] [--dereference]\n"
 "                   [--config=FILE]\n",
-[DELETE] = 
+[DELETE] =
 "    imagex delete WIMFILE (IMAGE_NUM | IMAGE_NAME | all) [--check]\n",
-[DIR] = 
+[DIR] =
 "    imagex dir WIMFILE (IMAGE_NUM | IMAGE_NAME | all)\n",
-[EXPORT] = 
+[EXPORT] =
 "    imagex export SRC_WIMFILE (SRC_IMAGE_NUM | SRC_IMAGE_NAME | all ) \n"
 "                  DEST_WIMFILE [DEST_IMAGE_NAME]\n"
 "                  [DEST_IMAGE_DESCRIPTION] [--boot] [--check]\n"
 "                  [--compress=TYPE] [--ref=\"GLOB\"]\n",
-[INFO] = 
+[INFO] =
 "    imagex info WIMFILE [IMAGE_NUM | IMAGE_NAME] [NEW_NAME]\n"
 "                [NEW_DESC] [--boot] [--check] [--header] [--lookup-table]\n"
 "                [--xml] [--extract-xml FILE] [--metadata]\n",
-[JOIN] = 
+[JOIN] =
 "    imagex join [--check] WIMFILE SPLIT_WIM...\n",
-[MOUNT] = 
+[MOUNT] =
 "    imagex mount WIMFILE (IMAGE_NUM | IMAGE_NAME) DIRECTORY\n"
 "                 [--check] [--debug] [--streams-interface=INTERFACE]\n"
 "                 [--ref=\"GLOB\"]\n",
-[MOUNTRW] = 
+[MOUNTRW] =
 "    imagex mountrw WIMFILE [IMAGE_NUM | IMAGE_NAME] DIRECTORY\n"
 "                   [--check] [--debug] [--streams-interface=INTERFACE]\n",
-[SPLIT] = 
+[SPLIT] =
 "    imagex split WIMFILE SPLIT_WIMFILE PART_SIZE_MB [--check]\n",
-[UNMOUNT] = 
+[UNMOUNT] =
 "    imagex unmount DIRECTORY [--commit] [--check]\n",
 };
 
@@ -792,7 +792,7 @@ static int imagex_export(int argc, const char **argv)
        if (ret != 0)
                return ret;
 
-       /* Determine if the destination is an existing file or not.  
+       /* Determine if the destination is an existing file or not.
         * If so, we try to append the exported image(s) to it; otherwise, we
         * create a new WIM containing the exported image(s). */
        if (stat(dest_wimfile, &stbuf) == 0) {
@@ -807,7 +807,7 @@ static int imagex_export(int argc, const char **argv)
                if (ret != 0)
                        goto out;
 
-               if (compression_type_specified && compression_type != 
+               if (compression_type_specified && compression_type !=
                                wimlib_get_compression_type(dest_w)) {
                        imagex_error("Cannot specify a compression type that is "
                                     "not the same as that used in the "
@@ -845,7 +845,7 @@ static int imagex_export(int argc, const char **argv)
                        goto out;
        }
 
-       ret = wimlib_export_image(src_w, image, dest_w, dest_name, dest_desc, 
+       ret = wimlib_export_image(src_w, image, dest_w, dest_name, dest_desc,
                                  export_flags, additional_swms,
                                  num_additional_swms);
        if (ret != 0)
@@ -853,7 +853,7 @@ static int imagex_export(int argc, const char **argv)
 
 
        if (wim_is_new)
-               ret = wimlib_write(dest_w, dest_wimfile, WIM_ALL_IMAGES, 
+               ret = wimlib_write(dest_w, dest_wimfile, WIM_ALL_IMAGES,
                                   write_flags);
        else
                ret = wimlib_overwrite(dest_w, write_flags);
@@ -887,7 +887,7 @@ static int imagex_info(int argc, const char **argv)
        FILE *fp;
        int image;
        int ret;
-       int open_flags = WIMLIB_OPEN_FLAG_SHOW_PROGRESS | 
+       int open_flags = WIMLIB_OPEN_FLAG_SHOW_PROGRESS |
                         WIMLIB_OPEN_FLAG_SPLIT_OK;
        int part_number;
        int total_parts;
@@ -939,7 +939,7 @@ static int imagex_info(int argc, const char **argv)
                        new_name = argv[2];
                        if (argc > 3) {
                                new_desc = argv[3];
-                       } 
+                       }
                }
        }
 
@@ -961,7 +961,7 @@ static int imagex_info(int argc, const char **argv)
 
        image = wimlib_resolve_image(w, image_num_or_name);
        if (image == WIM_NO_IMAGE && strcmp(image_num_or_name, "0") != 0) {
-               imagex_error("The image `%s' does not exist", 
+               imagex_error("The image `%s' does not exist",
                                                image_num_or_name);
                if (boot)
                        imagex_error("If you would like to set the boot "
@@ -1074,7 +1074,7 @@ static int imagex_info(int argc, const char **argv)
                        }
                }
                if (new_name) {
-                       if (strcmp(wimlib_get_image_name(w, image), 
+                       if (strcmp(wimlib_get_image_name(w, image),
                                                new_name) == 0) {
                                printf("Image %d is already named \"%s\".\n",
                                       image, new_name);
@@ -1097,7 +1097,7 @@ static int imagex_info(int argc, const char **argv)
                        } else {
                                printf("Changing the description of image %d "
                                       "to \"%s\".\n", image, new_desc);
-                               ret = wimlib_set_image_descripton(w, image, 
+                               ret = wimlib_set_image_descripton(w, image,
                                                                  new_desc);
                                if (ret != 0)
                                        goto done;
@@ -1106,11 +1106,11 @@ static int imagex_info(int argc, const char **argv)
 
                /* Only call wimlib_overwrite_xml_and_header() if something
                 * actually needs to be changed. */
-               if (boot || new_name || new_desc || 
+               if (boot || new_name || new_desc ||
                                check != wimlib_has_integrity_table(w)) {
 
-                       ret = wimlib_overwrite_xml_and_header(w, check ? 
-                                       WIMLIB_WRITE_FLAG_CHECK_INTEGRITY | 
+                       ret = wimlib_overwrite_xml_and_header(w, check ?
+                                       WIMLIB_WRITE_FLAG_CHECK_INTEGRITY |
                                        WIMLIB_WRITE_FLAG_SHOW_PROGRESS : 0);
                } else {
                        printf("The file `%s' was not modified because nothing "
@@ -1226,7 +1226,7 @@ static int imagex_mount_rw_or_ro(int argc, const char **argv)
                if (num_images != 1) {
                        imagex_error("The file `%s' contains %d images; Please "
                                     "select one", wimfile, num_images);
-                       usage((mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)  
+                       usage((mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)
                                        ? MOUNTRW : MOUNT);
                        ret = WIMLIB_ERR_INVALID_IMAGE;
                        goto out;
@@ -1255,7 +1255,7 @@ out:
                        wimlib_free(additional_swms[i]);
        return ret;
 mount_usage:
-       usage((mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)  
+       usage((mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)
                        ? MOUNTRW : MOUNT);
        return -1;
 }
@@ -1348,7 +1348,7 @@ static struct imagex_command imagex_commands[] = {
 
 static void version()
 {
-       static const char *s = 
+       static const char *s =
        "imagex (" PACKAGE ") " PACKAGE_VERSION "\n"
        "Copyright (C) 2012 Eric Biggers\n"
        "License GPLv3+; GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
@@ -1408,7 +1408,7 @@ static void usage_all()
        puts("IMAGEX: Usage:");
        for (int i = 0; i < ARRAY_LEN(usage_strings); i++)
                fputs(usage_strings[i], stdout);
-       static const char *extra = 
+       static const char *extra =
 "    imagex --help\n"
 "    imagex --version\n"
 "\n"
index b51000a28ff871949caae9f28a1439903fdbb34b..86a1912da48b90f10433f41aa74ecbcae02c80f7 100644 (file)
@@ -22,8 +22,8 @@ struct dentry;
  * including the stream length field (see below). */
 #define WIM_ADS_ENTRY_DISK_SIZE 38
 
-/* 
- * Reparse tags documented at 
+/*
+ * Reparse tags documented at
  * http://msdn.microsoft.com/en-us/library/dd541667(v=prot.10).aspx
  */
 #define WIM_IO_REPARSE_TAG_RESERVED_ZERO       0x00000000
@@ -99,9 +99,9 @@ static inline bool ads_entries_have_same_name(const struct ads_entry *entry_1,
                      entry_1->stream_name_len) == 0;
 }
 
-/* 
+/*
  * In-memory structure for a WIM directory entry (dentry).  There is a directory
- * tree for each image in the WIM. 
+ * tree for each image in the WIM.
  *
  * Note that this is a directory entry and not an inode.  Since NTFS allows hard
  * links, it's possible for a NTFS inode to correspond to multiple WIM dentries.
@@ -137,7 +137,7 @@ struct dentry {
        struct dentry *next;
        struct dentry *prev;
 
-       /* 
+       /*
         * Size of directory entry on disk, in bytes.  Typical size is around
         * 104 to 120 bytes.
         *
@@ -225,7 +225,7 @@ struct inode {
        int32_t security_id;
 
        /* %true iff the inode's lookup table entries has been resolved (i.e.
-        * the @lte field is valid, but the @hash field is not valid) 
+        * the @lte field is valid, but the @hash field is not valid)
         *
         * (This is not an on-disk field.) */
        u8 resolved : 1;
@@ -309,12 +309,12 @@ extern void stbuf_to_inode(const struct stat *stbuf, struct inode *inode);
 extern int inode_to_stbuf(const struct inode *inode,
                          struct lookup_table_entry *lte, struct stat *stbuf);
 
-extern int for_dentry_in_tree(struct dentry *root, 
-                             int (*visitor)(struct dentry*, void*), 
+extern int for_dentry_in_tree(struct dentry *root,
+                             int (*visitor)(struct dentry*, void*),
                              void *args);
 
-extern int for_dentry_in_tree_depth(struct dentry *root, 
-                                   int (*visitor)(struct dentry*, void*), 
+extern int for_dentry_in_tree_depth(struct dentry *root,
+                                   int (*visitor)(struct dentry*, void*),
                                    void *args);
 
 extern int calculate_dentry_full_path(struct dentry *dentry, void *ignore);
@@ -326,7 +326,7 @@ extern int get_names(char **name_utf16_ret, char **name_utf8_ret,
 extern struct dentry *get_dentry(struct WIMStruct *w, const char *path);
 extern struct inode *wim_pathname_to_inode(struct WIMStruct *w,
                                           const char *path);
-extern struct dentry *get_dentry_child_with_name(const struct dentry *dentry, 
+extern struct dentry *get_dentry_child_with_name(const struct dentry *dentry,
                                                 const char *name);
 extern struct dentry *get_parent_dentry(struct WIMStruct *w, const char *path);
 
@@ -360,11 +360,11 @@ extern struct ads_entry *inode_add_ads(struct inode *dentry,
 extern void inode_remove_ads(struct inode *inode, u16 idx,
                             struct lookup_table *lookup_table);
 
-extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len, 
+extern int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len,
                       u64 offset, struct dentry *dentry);
 
 
-extern int read_dentry_tree(const u8 metadata_resource[], 
+extern int read_dentry_tree(const u8 metadata_resource[],
                            u64 metadata_resource_len, struct dentry *dentry);
 
 extern u8 *write_dentry_tree(const struct dentry *tree, u8 *p);
index cba645bf30554359eab58152b2f9f14150c13b80..0a0728722d1e3d3a408644317a61583a23e49b05 100644 (file)
@@ -20,7 +20,7 @@ static inline uint32_t bswap32(uint32_t n)
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
        return __builtin_bswap32(n);
 #else
-       return (n << 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8) | 
+       return (n << 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8) |
                                                        (n >> 24);
 #endif
 }
@@ -32,9 +32,9 @@ static inline uint64_t bswap64(uint64_t n)
 #ifdef __GNUC__
        return __builtin_bswap64(n);
 #else
-       return (n << 56) | ((n & 0xff00) << 40) | ((n & 0xff0000) << 24) | 
-                       ((n & 0xff000000) << 8) | ((n & 0xff00000000) >> 8) | 
-                       ((n & 0xff0000000000) >> 24) | 
+       return (n << 56) | ((n & 0xff00) << 40) | ((n & 0xff0000) << 24) |
+                       ((n & 0xff000000) << 8) | ((n & 0xff00000000) >> 8) |
+                       ((n & 0xff0000000000) >> 24) |
                        ((n & 0xff000000000000) >> 40) | (n >> 56);
 #endif
 }
index 07c6d3def7db7c7363c75fd1b0680b0b4845d680..14accdac3119c6d4241ca6d86b4c9a0934d4b69e 100644 (file)
@@ -48,7 +48,7 @@
 /* Internal */
 #define WIMLIB_EXTRACT_FLAG_MULTI_IMAGE 0x80000000
 
-static int extract_regular_file_linked(const struct dentry *dentry, 
+static int extract_regular_file_linked(const struct dentry *dentry,
                                       const char *output_dir,
                                       const char *output_path,
                                       int extract_flags,
@@ -77,7 +77,7 @@ static int extract_regular_file_linked(const struct dentry *dentry,
 
                wimlib_assert(extract_flags & WIMLIB_EXTRACT_FLAG_SYMLINK);
 
-               num_path_components = 
+               num_path_components =
                        get_num_path_components(dentry->full_path_utf8) - 1;
                num_output_dir_path_components =
                        get_num_path_components(output_dir);
@@ -114,7 +114,7 @@ static int extract_regular_file_linked(const struct dentry *dentry,
 }
 
 static int extract_regular_file_unlinked(WIMStruct *w,
-                                        struct dentry *dentry, 
+                                        struct dentry *dentry,
                                         const char *output_path,
                                         int extract_flags,
                                         struct lookup_table_entry *lte)
@@ -188,11 +188,11 @@ out:
        return ret;
 }
 
-/* 
- * Extracts a regular file from the WIM archive. 
+/*
+ * Extracts a regular file from the WIM archive.
  */
-static int extract_regular_file(WIMStruct *w, 
-                               struct dentry *dentry, 
+static int extract_regular_file(WIMStruct *w,
+                               struct dentry *dentry,
                                const char *output_dir,
                                const char *output_path,
                                int extract_flags)
@@ -239,12 +239,12 @@ static int extract_symlink(const struct dentry *dentry, const char *output_path,
        return 0;
 }
 
-/* 
- * Extracts a directory from the WIM archive. 
+/*
+ * Extracts a directory from the WIM archive.
  *
  * @dentry:            The directory entry for the directory.
  * @output_path:       The path to which the directory is to be extracted to.
- * @return:            True on success, false on failure. 
+ * @return:            True on success, false on failure.
  */
 static int extract_directory(const char *output_path, bool is_root)
 {
@@ -282,7 +282,7 @@ struct extract_args {
        const char *output_dir;
 };
 
-/* 
+/*
  * Extracts a file, directory, or symbolic link from the WIM archive.  For use
  * in for_dentry_in_tree().
  */
@@ -381,7 +381,7 @@ static int extract_all_images(WIMStruct *w, const char *output_dir,
        memcpy(buf, output_dir, output_path_len);
        buf[output_path_len] = '/';
        for (image = 1; image <= w->hdr.image_count; image++) {
-               
+
                image_name = wimlib_get_image_name(w, image);
                if (*image_name) {
                        strcpy(buf + output_path_len + 1, image_name);
index 533a51379dd5bbf9938d32cf8f40d0bda220c481..b88f4555f237a605a9cfc480668b86d25c6a3e33 100644 (file)
 
 /*                             NULL        NULL
  *                              ^           ^
- *         dentry               |           |                
- *        /     \          -----------  -----------           
+ *         dentry               |           |
+ *        /     \          -----------  -----------
  *        |      dentry<---|  struct  | |  struct  |---> dentry
- *        \     /          |  inode   | |  inode   |       
+ *        \     /          |  inode   | |  inode   |
  *         dentry          ------------ ------------
  *                              ^           ^
  *                              |           |
@@ -47,7 +47,7 @@
  *                              ^           ^
  *                              |           |
  *                            -----------------
- *        inode_table->array  | idx 0 | idx 1 | 
+ *        inode_table->array  | idx 0 | idx 1 |
  *                            -----------------
  */
 
@@ -75,7 +75,7 @@ static size_t inode_link_count(const struct inode *inode)
        return size;
 }
 
-/* 
+/*
  * Insert a dentry into the inode table based on its inode
  * ID.
  *
@@ -263,7 +263,7 @@ static int fix_true_inode(struct inode *inode, struct hlist_head *inode_list)
        return 0;
 }
 
-/* 
+/*
  * Fixes up a nominal inode.
  *
  * By a nominal inode we mean a group of two or more dentries that share
index 5563d7058db78932202f2ea5bff1ac04feb5563a..69d4f695dbbdf0a4be057ecf404abb8904dbf100 100644 (file)
@@ -28,7 +28,7 @@
 #include "io.h"
 
 /* First 8 bytes in every WIM file. */
-static const u8 wim_magic_chars[WIM_MAGIC_LEN] = { 
+static const u8 wim_magic_chars[WIM_MAGIC_LEN] = {
                        'M', 'S', 'W', 'I', 'M', '\0', '\0', '\0' };
 
 /* Reads the header for a WIM file.  */
@@ -44,7 +44,7 @@ int read_header(FILE *fp, struct wim_header *hdr, int open_flags)
        u32 chunk_size;
 
        DEBUG("Reading WIM header.");
-       
+
        bytes_read = fread(buf, 1, WIM_MAGIC_LEN, fp);
 
        if (bytes_read != WIM_MAGIC_LEN)
@@ -75,7 +75,7 @@ int read_header(FILE *fp, struct wim_header *hdr, int open_flags)
 
        hdr_rem_size = WIM_HEADER_DISK_SIZE - WIM_MAGIC_LEN - sizeof(u32);
 
-       bytes_read = fread(buf + WIM_MAGIC_LEN + sizeof(u32), 1, 
+       bytes_read = fread(buf + WIM_MAGIC_LEN + sizeof(u32), 1,
                           hdr_rem_size, fp);
        if (bytes_read != hdr_rem_size)
                goto err;
@@ -91,7 +91,7 @@ int read_header(FILE *fp, struct wim_header *hdr, int open_flags)
 
        p = get_u32(p, &hdr->flags);
        p = get_u32(p, &chunk_size);
-       if (chunk_size != WIM_CHUNK_SIZE && 
+       if (chunk_size != WIM_CHUNK_SIZE &&
            (hdr->flags & WIM_HDR_FLAG_COMPRESSION)) {
                ERROR("Unexpected chunk size of %u! Ask the author to "
                      "implement support for other chunk sizes.",
@@ -147,7 +147,7 @@ err:
        return WIMLIB_ERR_READ;
 }
 
-/* 
+/*
  * Writes the header for a WIM file.
  *
  * @hdr:       A pointer to a struct wim_header structure that describes the header.
@@ -165,7 +165,7 @@ int write_header(const struct wim_header *hdr, FILE *out_fp)
        p = put_u32(p, WIM_HEADER_DISK_SIZE);
        p = put_u32(p, WIM_VERSION);
        p = put_u32(p, hdr->flags);
-       p = put_u32(p, (hdr->flags & WIM_HDR_FLAG_COMPRESSION) ? 
+       p = put_u32(p, (hdr->flags & WIM_HDR_FLAG_COMPRESSION) ?
                                WIM_CHUNK_SIZE : 0);
        /* byte 24 */
 
@@ -201,11 +201,11 @@ int init_header(struct wim_header *hdr, int ctype)
                hdr->flags = 0;
                break;
        case WIM_COMPRESSION_TYPE_LZX:
-               hdr->flags = WIM_HDR_FLAG_COMPRESSION | 
+               hdr->flags = WIM_HDR_FLAG_COMPRESSION |
                             WIM_HDR_FLAG_COMPRESS_LZX;
                break;
        case WIM_COMPRESSION_TYPE_XPRESS:
-               hdr->flags = WIM_HDR_FLAG_COMPRESSION | 
+               hdr->flags = WIM_HDR_FLAG_COMPRESSION |
                             WIM_HDR_FLAG_COMPRESS_XPRESS;
                break;
        default:
@@ -258,37 +258,37 @@ WIMLIBAPI void wimlib_print_header(const WIMStruct *w)
        printf("Part Number                 = %hu\n", w->hdr.part_number);
        printf("Total Parts                 = %hu\n", w->hdr.total_parts);
        printf("Image Count                 = %u\n", hdr->image_count);
-       printf("Lookup Table Size           = %"PRIu64"\n", 
+       printf("Lookup Table Size           = %"PRIu64"\n",
                                (u64)hdr->lookup_table_res_entry.size);
-       printf("Lookup Table Flags          = 0x%hhx\n", 
+       printf("Lookup Table Flags          = 0x%hhx\n",
                                hdr->lookup_table_res_entry.flags);
        printf("Lookup Table Offset         = %"PRIu64"\n",
                                hdr->lookup_table_res_entry.offset);
-       printf("Lookup Table Original_size  = %"PRIu64"\n", 
+       printf("Lookup Table Original_size  = %"PRIu64"\n",
                                hdr->lookup_table_res_entry.original_size);
-       printf("XML Data Size               = %"PRIu64"\n", 
+       printf("XML Data Size               = %"PRIu64"\n",
                                (u64)hdr->xml_res_entry.size);
-       printf("XML Data Flags              = 0x%hhx\n", 
+       printf("XML Data Flags              = 0x%hhx\n",
                                hdr->xml_res_entry.flags);
-       printf("XML Data Offset             = %"PRIu64"\n", 
+       printf("XML Data Offset             = %"PRIu64"\n",
                                hdr->xml_res_entry.offset);
-       printf("XML Data Original Size      = %"PRIu64"\n", 
+       printf("XML Data Original Size      = %"PRIu64"\n",
                                hdr->xml_res_entry.original_size);
-       printf("Boot Metadata Size          = %"PRIu64"\n", 
+       printf("Boot Metadata Size          = %"PRIu64"\n",
                                (u64)hdr->boot_metadata_res_entry.size);
-       printf("Boot Metadata Flags         = 0x%hhx\n", 
+       printf("Boot Metadata Flags         = 0x%hhx\n",
                                hdr->boot_metadata_res_entry.flags);
-       printf("Boot Metadata Offset        = %"PRIu64"\n", 
+       printf("Boot Metadata Offset        = %"PRIu64"\n",
                                hdr->boot_metadata_res_entry.offset);
-       printf("Boot Metadata Original Size = %"PRIu64"\n", 
+       printf("Boot Metadata Original Size = %"PRIu64"\n",
                                hdr->boot_metadata_res_entry.original_size);
        printf("Boot Index                  = %u\n", hdr->boot_idx);
-       printf("Integrity Size              = %"PRIu64"\n", 
+       printf("Integrity Size              = %"PRIu64"\n",
                                        (u64)hdr->integrity.size);
-       printf("Integrity Flags             = 0x%hhx\n", 
+       printf("Integrity Flags             = 0x%hhx\n",
                                        hdr->integrity.flags);
-       printf("Integrity Offset            = %"PRIu64"\n", 
+       printf("Integrity Offset            = %"PRIu64"\n",
                                        hdr->integrity.offset);
-       printf("Integrity Original_size     = %"PRIu64"\n", 
+       printf("Integrity Original_size     = %"PRIu64"\n",
                                        hdr->integrity.original_size);
 }
index f94b7436b331f840e12382a5d879f859eb62f355..73dd94f6884498b2ff806ee08df821d1d73756eb 100644 (file)
 #define INTEGRITY_CHUNK_SIZE 10485760
 
 /*
- * Verifies the integrity of a WIM. 
+ * Verifies the integrity of a WIM.
  *
- * @fp:                   FILE* of the WIM, currently positioned at the end of the header. 
+ * @fp:                   FILE* of the WIM, currently positioned at the end of the header.
  * @num_bytes:    Number of bytes to verify the integrity of.
  * @chunk_size:           Chunk size per SHA1 message digest.
  * @sha1sums:     Array of SHA1 message digests; 20 bytes each, one per chunk.
  * @show_progress: Nonzero if the percent complete is to be printed after every
  *                     chunk.
- * @status:       On success, set to WIM_INTEGRITY_OK or WIM_INTEGRITY_NOT_OK 
+ * @status:       On success, set to WIM_INTEGRITY_OK or WIM_INTEGRITY_NOT_OK
  *                     based on whether the WIM is intact or not.
  */
-static int verify_integrity(FILE *fp, u64 num_bytes, u32 chunk_size, 
+static int verify_integrity(FILE *fp, u64 num_bytes, u32 chunk_size,
                            const u8 *sha1sums, int show_progress,
                            int *status)
 {
@@ -65,10 +65,10 @@ static int verify_integrity(FILE *fp, u64 num_bytes, u32 chunk_size,
        bytes_remaining = num_bytes;
        while (bytes_remaining != 0) {
                if (show_progress) {
-                       percent_done = (num_bytes - bytes_remaining) * 100 / 
+                       percent_done = (num_bytes - bytes_remaining) * 100 /
                                        num_bytes;
                        printf("Verifying integrity of WIM (%"PRIu64" bytes "
-                                       "remaining, %u%% done)       \r", 
+                                       "remaining, %u%% done)       \r",
                                        bytes_remaining, percent_done);
                        fflush(stdout);
                }
@@ -103,7 +103,7 @@ verify_integrity_error:
 }
 
 /*
- * Verifies the integrity of the WIM. 
+ * Verifies the integrity of the WIM.
  *
  * @show_progress: Nonzero if the percent complete is to be printed after every
  *                     chunk.
@@ -186,7 +186,7 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
 
        if (integrity_table_size != expected_size) {
                ERROR("Integrity table is %u bytes, but expected %"PRIu64" "
-                     "bytes to hold %u entries", 
+                     "bytes to hold %u entries",
                      integrity_table_size, expected_size, num_entries);
                ret = WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
                goto out;
@@ -232,24 +232,24 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
        }
        /* call verify_integrity(), which does the actual checking of the SHA1
         * message digests. */
-       ret = verify_integrity(w->fp, bytes_to_check, chunk_size, p, 
+       ret = verify_integrity(w->fp, bytes_to_check, chunk_size, p,
                               show_progress, status);
 out:
        FREE(buf);
        return ret;
 }
 
-/* 
+/*
  * Writes integrity information to the output stream for a WIM file being
- * written. 
+ * written.
  *
  * @end_header_offset is the offset of the byte after the header, which is the
  *     beginning of the region that is checksummed.
  *
  * @end_lookup_table_offset is the offset of the byte after the lookup table,
- *     which is the end of the region that is checksummed. 
+ *     which is the end of the region that is checksummed.
  */
-int write_integrity_table(FILE *out, u64 end_header_offset, 
+int write_integrity_table(FILE *out, u64 end_header_offset,
                          u64 end_lookup_table_offset, int show_progress)
 {
        u64   bytes_to_check;
@@ -301,13 +301,13 @@ int write_integrity_table(FILE *out, u64 end_header_offset,
 
        while (bytes_remaining != 0) {
 
-               uint percent_done = (bytes_to_check - bytes_remaining) * 
+               uint percent_done = (bytes_to_check - bytes_remaining) *
                                    100 / bytes_to_check;
 
                if (show_progress) {
                        printf("Calculating integrity checksums for WIM "
                                        "(%"PRIu64" bytes remaining, %u%% "
-                                       "done)      \r", 
+                                       "done)      \r",
                                        bytes_remaining, percent_done);
                        fflush(stdout);
                }
index f41cf047bc80ceb79f2bbd5450f8faa6f93d134a..8bdd24be83605b1ad9a7c71bfd6200f24e8424cb 100644 (file)
@@ -94,7 +94,7 @@ int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
        for (unsigned i = 0; i < num_additional_swms; i++) {
                if (additional_swms[i]->hdr.total_parts != total_parts) {
                        ERROR("WIM `%s' says there are %u parts in the spanned set, "
-                             "but %u parts were provided", 
+                             "but %u parts were provided",
                              additional_swms[i]->filename,
                              additional_swms[i]->hdr.total_parts,
                              total_parts);
@@ -125,7 +125,7 @@ int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
                }
                if (swm->hdr.part_number == 1) {
                        ERROR("WIMs `%s' and `%s' both are marked as the "
-                             "first WIM in the spanned set", 
+                             "first WIM in the spanned set",
                              w->filename, swm->filename);
                        return WIMLIB_ERR_SPLIT_INVALID;
                }
@@ -154,7 +154,7 @@ int verify_swm_set(WIMStruct *w, WIMStruct **additional_swms,
        return 0;
 }
 
-/* 
+/*
  * Joins lookup tables from the parts of a split WIM.
  *
  * @w specifies the first part, while @additional_swms and @num_additional_swms
@@ -223,7 +223,7 @@ static int join_wims(WIMStruct **swms, uint num_swms, WIMStruct *joined_wim,
                }
                swms[i]->out_fp = out_fp;
                swms[i]->hdr.part_number = 1;
-               ret = for_lookup_table_entry(swms[i]->lookup_table, 
+               ret = for_lookup_table_entry(swms[i]->lookup_table,
                                             copy_resource, swms[i]);
                if (ret != 0)
                        return ret;
@@ -234,11 +234,11 @@ static int join_wims(WIMStruct **swms, uint num_swms, WIMStruct *joined_wim,
        }
        swms[0]->write_metadata = true;
        if (write_flags & WIMLIB_WRITE_FLAG_SHOW_PROGRESS)
-               printf("Writing %d metadata resources\n", 
+               printf("Writing %d metadata resources\n",
                        swms[0]->hdr.image_count);
 
        for (i = 0; i < swms[0]->hdr.image_count; i++) {
-               ret = copy_resource(swms[0]->image_metadata[i].metadata_lte, 
+               ret = copy_resource(swms[0]->image_metadata[i].metadata_lte,
                                    swms[0]);
                if (ret != 0)
                        return ret;
@@ -263,7 +263,7 @@ static int join_wims(WIMStruct **swms, uint num_swms, WIMStruct *joined_wim,
                return WIMLIB_ERR_WRITE;
        }
        swms[0]->hdr.lookup_table_res_entry.offset = lookup_table_offset;
-       swms[0]->hdr.lookup_table_res_entry.size = 
+       swms[0]->hdr.lookup_table_res_entry.size =
                                        xml_data_offset - lookup_table_offset;
 
 
@@ -276,7 +276,7 @@ static int join_wims(WIMStruct **swms, uint num_swms, WIMStruct *joined_wim,
 }
 
 
-WIMLIBAPI int wimlib_join(const char **swm_names, unsigned num_swms, 
+WIMLIBAPI int wimlib_join(const char **swm_names, unsigned num_swms,
                          const char *output_path, int flags)
 {
        int i;
@@ -295,7 +295,7 @@ WIMLIBAPI int wimlib_join(const char **swm_names, unsigned num_swms,
        ZERO_ARRAY(swms);
 
        for (i = 0; i < num_swms; i++) {
-               ret = wimlib_open_wim(swm_names[i], 
+               ret = wimlib_open_wim(swm_names[i],
                                      flags | WIMLIB_OPEN_FLAG_SPLIT_OK, &swms[i]);
                if (ret != 0)
                        goto out;
index 1226488acebee959713f8cbbd9a89287c9334c6f..142e7e0472f046cb8708faca88e61451d9b28c62 100644 (file)
@@ -59,7 +59,7 @@ err:
 struct lookup_table_entry *new_lookup_table_entry()
 {
        struct lookup_table_entry *lte;
-       
+
        lte = CALLOC(1, sizeof(struct lookup_table_entry));
        if (lte) {
                lte->part_number  = 1;
@@ -185,7 +185,7 @@ void free_lookup_table(struct lookup_table *table)
  * @table:     A pointer to the lookup table.
  * @entry:     A pointer to the entry to insert.
  */
-void lookup_table_insert(struct lookup_table *table, 
+void lookup_table_insert(struct lookup_table *table,
                         struct lookup_table_entry *lte)
 {
        size_t i = lte->hash_short % table->capacity;
@@ -237,11 +237,11 @@ void lte_decrement_num_opened_fds(struct lookup_table_entry *lte,
 }
 #endif
 
-/* 
+/*
  * Calls a function on all the entries in the lookup table.  Stop early and
  * return nonzero if any call to the function returns nonzero.
  */
-int for_lookup_table_entry(struct lookup_table *table, 
+int for_lookup_table_entry(struct lookup_table *table,
                           int (*visitor)(struct lookup_table_entry *, void *),
                           void *arg)
 {
@@ -311,7 +311,7 @@ int read_lookup_table(WIMStruct *w)
                }
                cur_entry->wim = w;
                cur_entry->resource_location = RESOURCE_IN_WIM;
-                        
+
                p = get_resource_entry(buf, &cur_entry->resource_entry);
                p = get_u16(p, &cur_entry->part_number);
                p = get_u32(p, &cur_entry->refcnt);
@@ -369,7 +369,7 @@ out:
 }
 
 
-/* 
+/*
  * Writes a lookup table entry to the output file.
  */
 int write_lookup_table_entry(struct lookup_table_entry *lte, void *__out)
@@ -426,11 +426,11 @@ void print_lookup_table_entry(const struct lookup_table_entry *lte)
                putchar('\n');
                return;
        }
-       printf("Offset            = %"PRIu64" bytes\n", 
+       printf("Offset            = %"PRIu64" bytes\n",
               lte->resource_entry.offset);
-       printf("Size              = %"PRIu64" bytes\n", 
+       printf("Size              = %"PRIu64" bytes\n",
               (u64)lte->resource_entry.size);
-       printf("Original size     = %"PRIu64" bytes\n", 
+       printf("Original size     = %"PRIu64" bytes\n",
               lte->resource_entry.original_size);
        printf("Part Number       = %hu\n", lte->part_number);
        printf("Reference Count   = %u\n", lte->refcnt);
@@ -475,16 +475,16 @@ static int do_print_lookup_table_entry(struct lookup_table_entry *lte,
 }
 
 /*
- * Prints the lookup table of a WIM file. 
+ * Prints the lookup table of a WIM file.
  */
 WIMLIBAPI void wimlib_print_lookup_table(WIMStruct *w)
 {
-       for_lookup_table_entry(w->lookup_table, 
+       for_lookup_table_entry(w->lookup_table,
                               do_print_lookup_table_entry,
                               NULL);
 }
 
-/* 
+/*
  * Looks up an entry in the lookup table.
  */
 struct lookup_table_entry *
@@ -505,7 +505,7 @@ __lookup_resource(const struct lookup_table *table, const u8 hash[])
 }
 
 #ifdef WITH_FUSE
-/* 
+/*
  * Finds the dentry, lookup table entry, and stream index for a WIM file stream,
  * given a path name.
  *
@@ -610,7 +610,7 @@ static void inode_unresolve_ltes(struct inode *inode)
        inode->resolved = false;
 }
 
-/* Resolve a dentry's lookup table entries 
+/* Resolve a dentry's lookup table entries
  *
  * This replaces the SHA1 hash fields (which are used to lookup an entry in the
  * lookup table) with pointers directly to the lookup table entries.  A circular
index 524e17e67ae8ec4510af14158c4682a8e9f98d18..92eac33f067cd465e2e3d4b07e0d8619dc243409 100644 (file)
@@ -36,16 +36,16 @@ struct ntfs_location {
 };
 #endif
 
-/* 
- * An entry in the lookup table in the WIM file. 
+/*
+ * An entry in the lookup table in the WIM file.
  *
- * It is used to find data streams for files in the WIM. 
+ * It is used to find data streams for files in the WIM.
  *
  * Metadata resources and reparse point data buffers will also have lookup table
  * entries associated with the data.
  *
  * The lookup_table_entry for a given dentry or alternate stream entry in the
- * WIM is found using the SHA1 message digest field. 
+ * WIM is found using the SHA1 message digest field.
  */
 struct lookup_table_entry {
 
@@ -226,11 +226,11 @@ wim_resource_compression_type(const struct lookup_table_entry *lte)
 
 extern struct lookup_table *new_lookup_table(size_t capacity);
 
-extern void lookup_table_insert(struct lookup_table *table, 
+extern void lookup_table_insert(struct lookup_table *table,
                                struct lookup_table_entry *lte);
 
 /* Unlinks a lookup table entry from the table; does not free it. */
-static inline void lookup_table_unlink(struct lookup_table *table, 
+static inline void lookup_table_unlink(struct lookup_table *table,
                                       struct lookup_table_entry *lte)
 {
        hlist_del(&lte->hash_list);
@@ -242,8 +242,8 @@ extern struct lookup_table_entry *new_lookup_table_entry();
 extern struct lookup_table_entry *
 clone_lookup_table_entry(const struct lookup_table_entry *lte);
 
-extern int for_lookup_table_entry(struct lookup_table *table, 
-                                 int (*visitor)(struct lookup_table_entry *, void *), 
+extern int for_lookup_table_entry(struct lookup_table *table,
+                                 int (*visitor)(struct lookup_table_entry *, void *),
                                  void *arg);
 
 extern struct lookup_table_entry *
@@ -283,7 +283,7 @@ static inline int write_lookup_table(struct lookup_table *table, FILE *out)
 }
 
 /* Unlinks and frees an entry from a lookup table. */
-static inline void lookup_table_remove(struct lookup_table *table, 
+static inline void lookup_table_remove(struct lookup_table *table,
                                       struct lookup_table_entry *lte)
 {
        lookup_table_unlink(table, lte);
@@ -322,7 +322,7 @@ inode_stream_lte_unresolved(const struct inode *inode, unsigned stream_idx,
                                         inode->ads_entries[
                                                stream_idx - 1].hash);
 }
-/* 
+/*
  * Returns the lookup table entry for stream @stream_idx of the inode, where
  * stream_idx = 0 means the default un-named file stream, and stream_idx >= 1
  * corresponds to an alternate data stream.
@@ -363,7 +363,7 @@ static inline const u8 *inode_stream_hash_resolved(const struct inode *inode,
                return zero_hash;
 }
 
-/* 
+/*
  * Returns the hash for stream @stream_idx of the inode, where stream_idx = 0
  * means the default un-named file stream, and stream_idx >= 1 corresponds to an
  * alternate data stream.
index ddf2017aac2270a9d56db13a157d18fc7c182e86..c248acf597b95777821d21cebcf81210ebdba01e 100644 (file)
--- a/src/lz.c
+++ b/src/lz.c
@@ -70,7 +70,7 @@ static inline uint update_hash(uint hash, u8 c)
  * to walk through the hash chain, until the special index `0' is reached,
  * indicating the end of the hash chain.
  */
-static inline uint insert_string(u16 hash_tab[], u16 prev_tab[], 
+static inline uint insert_string(u16 hash_tab[], u16 prev_tab[],
                                 const u8 window[], uint str_pos, uint hash)
 {
        hash = update_hash(hash, window[str_pos + LZ_MIN_MATCH - 1]);
@@ -88,10 +88,10 @@ static inline uint insert_string(u16 hash_tab[], u16 prev_tab[],
  * @strstart:          The index of the start of the string in the window that
  *                             we are trying to find a match for.
  * @prev_tab:          The array of prev pointers for the hash table.
- * @cur_match:         The index of the head of the hash chain for matches 
- *                             having the hash value of the string beginning 
+ * @cur_match:         The index of the head of the hash chain for matches
+ *                             having the hash value of the string beginning
  *                             at index @strstart.
- * @prev_len:          The length of the match that was found for the string 
+ * @prev_len:          The length of the match that was found for the string
  *                             beginning at (@strstart - 1).
  * @match_start_ret:   A location into which the index of the start of the
  *                             match will be returned.
@@ -102,9 +102,9 @@ static inline uint insert_string(u16 hash_tab[], u16 prev_tab[],
  * Returns the length of the match that was found.
  */
 static uint longest_match(const u8 window[], uint bytes_remaining,
-                         uint strstart, const u16 prev_tab[], 
-                         uint cur_match, uint prev_len, 
-                         uint *match_start_ret, 
+                         uint strstart, const u16 prev_tab[],
+                         uint cur_match, uint prev_len,
+                         uint *match_start_ret,
                          const struct lz_params *params)
 {
        uint chain_len = params->max_chain_len;
@@ -167,7 +167,7 @@ static uint longest_match(const u8 window[], uint bytes_remaining,
                if (len > best_len) {
                        match_start = cur_match;
                        best_len = len;
-                       if (len >= nice_match) 
+                       if (len >= nice_match)
                                break;
                        scan_end1  = scan[best_len - 1];
                        scan_end   = scan[best_len];
@@ -179,7 +179,7 @@ static uint longest_match(const u8 window[], uint bytes_remaining,
 
 
 
-/* 
+/*
  * Determines the sequence of matches and literals that a block of data will be
  * compressed to.
  *
@@ -195,8 +195,8 @@ static uint longest_match(const u8 window[], uint bytes_remaining,
  * @record_literal:    A function that will be called to produce the
  *                             intermediate representation of a literal, given
  *                             the character of the literal.  This function
- *                             should also update the appropriate symbol 
- *                             frequency counts so that any needed Huffman 
+ *                             should also update the appropriate symbol
+ *                             frequency counts so that any needed Huffman
  *                             codes can be made later.
  * @record_match_arg_1:
  * @record_match_arg_2:        Extra arguments to be passed to @record_match.
@@ -239,8 +239,8 @@ uint lz_analyze_block(const u8 uncompressed_data[], uint uncompressed_len,
                 * hash_head is set to the index of the previous string in the
                 * hash bucket, or 0 if there is no such string */
                if (uncompressed_len - cur_input_pos >= params->min_match) {
-                       hash = insert_string(hash_tab, prev_tab, 
-                                            uncompressed_data, 
+                       hash = insert_string(hash_tab, prev_tab,
+                                            uncompressed_data,
                                             cur_input_pos, hash);
                        hash_head = prev_tab[cur_input_pos];
                } else {
@@ -258,9 +258,9 @@ uint lz_analyze_block(const u8 uncompressed_data[], uint uncompressed_len,
                         * string of window index 0 (in particular we have to
                         * avoid a match of the string with itself at the start
                         * of the input file).  */
-                       match_len = longest_match(uncompressed_data, 
+                       match_len = longest_match(uncompressed_data,
                                                  uncompressed_len - cur_input_pos,
-                                                 cur_input_pos, prev_tab, 
+                                                 cur_input_pos, prev_tab,
                                                  hash_head, prev_len,
                                                  &match_start, params);
 
@@ -282,8 +282,8 @@ uint lz_analyze_block(const u8 uncompressed_data[], uint uncompressed_len,
                                        /*cur_input_pos - 1 - prev_start,*/
                                        /*prev_len);*/
 
-                       match = (*record_match)(cur_input_pos - 1 - prev_start, 
-                                               prev_len, 
+                       match = (*record_match)(cur_input_pos - 1 - prev_start,
+                                               prev_len,
                                                record_match_arg1,
                                                record_match_arg2);
 
index 328627de3f842f0dc0471294fa8cfcb42101931a..899d1dada6942ce83850a4706f35fb5d25228805 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lzx-comp.c
  *
- * LZX compression routines.  
+ * LZX compression routines.
  *
  * This code was originally based on code written by Matthew T. Russotto
  *     (liblzxcomp).
@@ -29,7 +29,7 @@
 
 
 
-/* 
+/*
  * This file provides lzx_compress(), a function to compress an in-memory buffer
  * of data using LZX compression, as used in the WIM file format.
  *
@@ -41,7 +41,7 @@
  * tricky to understand.  Basically it is the following:
  *
  * - Preprocess the input data (LZX-specific)
- * - Go through the input data and determine matches.  This part is based on 
+ * - Go through the input data and determine matches.  This part is based on
  *       code from zlib, and a hash table of 3-character strings is used to
  *       accelerate the process of finding matches.
  * - Build the Huffman trees based on the frequencies of symbols determined
@@ -72,7 +72,7 @@ struct lzx_codes {
 };
 
 struct lzx_freq_tables {
-       u32 main_freq_table[LZX_MAINTREE_NUM_SYMBOLS]; 
+       u32 main_freq_table[LZX_MAINTREE_NUM_SYMBOLS];
        u32 len_freq_table[LZX_LENTREE_NUM_SYMBOLS];
        u32 aligned_freq_table[LZX_ALIGNEDTREE_NUM_SYMBOLS];
 };
@@ -92,13 +92,13 @@ static uint lzx_get_position_slot(uint formatted_offset)
        int mid;
 
        /* Calculate position base using binary search of table; if log2 can be
-        * done in hardware, approximation might work; 
+        * done in hardware, approximation might work;
         * trunc(log2(formatted_offset*formatted_offset)) gets either the proper
         * position slot or the next one, except for slots 0, 1, and 39-49
         *
         * Slots 0-1 are handled by the R0-R1 procedures
         *
-        * Slots 36-49 (formatted_offset >= 262144) can be found by 
+        * Slots 36-49 (formatted_offset >= 262144) can be found by
         * (formatted_offset/131072) + 34 == (formatted_offset >> 17) + 34;
         */
        if (formatted_offset >= 262144) {
@@ -133,7 +133,7 @@ static u32 lzx_record_literal(u8 literal, void *__main_freq_tab)
  * alphabets.  The return value is a 32-bit integer that, if the high bit is
  * set, contains the match length, the position slot, and the position footer
  * for the match.  */
-static u32 lzx_record_match(uint match_offset, uint match_len, 
+static u32 lzx_record_match(uint match_offset, uint match_len,
                            void *__freq_tabs, void *__queue)
 {
        struct lzx_freq_tables *freq_tabs = __freq_tabs;
@@ -209,7 +209,7 @@ static u32 lzx_record_match(uint match_offset, uint match_len,
        return match;
 }
 
-/* 
+/*
  * Writes a compressed literal match to the output.
  *
  * @out:         The output bitstream.
@@ -266,7 +266,7 @@ static int lzx_write_match(struct output_bitstream *out, int block_type,
        main_symbol = len_pos_header + LZX_NUM_CHARS;
 
        /* Output main symbol. */
-       ret = bitstream_put_bits(out, codes->main_codewords[main_symbol], 
+       ret = bitstream_put_bits(out, codes->main_codewords[main_symbol],
                                 codes->main_lens[main_symbol]);
        if (ret != 0)
                return ret;
@@ -289,15 +289,15 @@ static int lzx_write_match(struct output_bitstream *out, int block_type,
         * aligned offset tree.  Otherwise, only the verbatim bits need to be
         * output. */
        if ((block_type == LZX_BLOCKTYPE_ALIGNED) && (num_extra_bits >= 3)) {
-               
+
                verbatim_bits = position_footer >> 3;
-               ret = bitstream_put_bits(out, verbatim_bits, 
+               ret = bitstream_put_bits(out, verbatim_bits,
                                         num_extra_bits - 3);
                if (ret != 0)
                        return ret;
 
                aligned_bits = (position_footer & 7);
-               ret = bitstream_put_bits(out, 
+               ret = bitstream_put_bits(out,
                                         codes->aligned_codewords[aligned_bits],
                                         codes->aligned_lens[aligned_bits]);
                if (ret != 0)
@@ -312,7 +312,7 @@ static int lzx_write_match(struct output_bitstream *out, int block_type,
        return 0;
 }
 
-/* 
+/*
  * Writes all compressed literals in a block, both matches and literal bytes, to
  * the output bitstream.
  *
@@ -324,9 +324,9 @@ static int lzx_write_match(struct output_bitstream *out, int block_type,
  * @codes:     Pointer to a structure that contains the codewords for the
  *                     main, length, and aligned offset Huffman codes.
  */
-static int lzx_write_compressed_literals(struct output_bitstream *ostream, 
+static int lzx_write_compressed_literals(struct output_bitstream *ostream,
                                         int block_type,
-                                        const u32 match_tab[], 
+                                        const u32 match_tab[],
                                         uint  num_compressed_literals,
                                         const struct lzx_codes *codes)
 {
@@ -341,14 +341,14 @@ static int lzx_write_compressed_literals(struct output_bitstream *ostream,
                 * actual match (1) or a literal uncompressed byte (0) */
                if (match & 0x80000000) {
                        /* match */
-                       ret = lzx_write_match(ostream, block_type, match, 
+                       ret = lzx_write_match(ostream, block_type, match,
                                              codes);
                        if (ret != 0)
                                return ret;
                } else {
                        /* literal byte */
                        wimlib_assert(match < LZX_NUM_CHARS);
-                       ret = bitstream_put_bits(ostream, 
+                       ret = bitstream_put_bits(ostream,
                                                 codes->main_codewords[match],
                                                 codes->main_lens[match]);
                        if (ret != 0)
@@ -358,7 +358,7 @@ static int lzx_write_compressed_literals(struct output_bitstream *ostream,
        return 0;
 }
 
-/* 
+/*
  * Writes a compressed Huffman tree to the output, preceded by the pretree for
  * it.
  *
@@ -374,8 +374,8 @@ static int lzx_write_compressed_literals(struct output_bitstream *ostream,
  * @lens:      The code lengths for the Huffman tree, indexed by symbol.
  * @num_symbols:       The number of symbols in the code.
  */
-static int lzx_write_compressed_tree(struct output_bitstream *out, 
-                               const u8 lens[], 
+static int lzx_write_compressed_tree(struct output_bitstream *out,
+                               const u8 lens[],
                                uint num_symbols)
 {
        /* Frequencies of the length symbols, including the RLE symbols (NOT the
@@ -497,14 +497,14 @@ static int lzx_write_compressed_tree(struct output_bitstream *out,
 
        /* Build the pretree from the frequencies of the length symbols. */
 
-       make_canonical_huffman_code(LZX_PRETREE_NUM_SYMBOLS, 
-                                   LZX_MAX_CODEWORD_LEN, 
-                                   pretree_freqs, pretree_lens, 
+       make_canonical_huffman_code(LZX_PRETREE_NUM_SYMBOLS,
+                                   LZX_MAX_CODEWORD_LEN,
+                                   pretree_freqs, pretree_lens,
                                    pretree_codewords);
 
        /* Write the lengths of the pretree codes to the output. */
        for (i = 0; i < LZX_PRETREE_NUM_SYMBOLS; i++)
-               bitstream_put_bits(out, pretree_lens[i], 
+               bitstream_put_bits(out, pretree_lens[i],
                                   LZX_PRETREE_ELEMENT_SIZE);
 
        /* Write the length symbols, encoded with the pretree, to the output. */
@@ -513,7 +513,7 @@ static int lzx_write_compressed_tree(struct output_bitstream *out,
        while (i < output_syms_idx) {
                pretree_sym = output_syms[i++];
 
-               bitstream_put_bits(out, pretree_codewords[pretree_sym], 
+               bitstream_put_bits(out, pretree_codewords[pretree_sym],
                                   pretree_lens[pretree_sym]);
                switch (pretree_sym) {
                case 17:
@@ -524,7 +524,7 @@ static int lzx_write_compressed_tree(struct output_bitstream *out,
                        break;
                case 19:
                        bitstream_put_bits(out, output_syms[i++], 1);
-                       bitstream_put_bits(out, 
+                       bitstream_put_bits(out,
                                           pretree_codewords[output_syms[i]],
                                           pretree_lens[output_syms[i]]);
                        i++;
@@ -541,20 +541,20 @@ static int lzx_write_compressed_tree(struct output_bitstream *out,
 static void lzx_make_huffman_codes(const struct lzx_freq_tables *freq_tabs,
                                struct lzx_codes *codes)
 {
-       make_canonical_huffman_code(LZX_MAINTREE_NUM_SYMBOLS, 
+       make_canonical_huffman_code(LZX_MAINTREE_NUM_SYMBOLS,
                                        LZX_MAX_CODEWORD_LEN,
-                                       freq_tabs->main_freq_table, 
+                                       freq_tabs->main_freq_table,
                                        codes->main_lens,
                                        codes->main_codewords);
 
-       make_canonical_huffman_code(LZX_LENTREE_NUM_SYMBOLS, 
+       make_canonical_huffman_code(LZX_LENTREE_NUM_SYMBOLS,
                                        LZX_MAX_CODEWORD_LEN,
-                                       freq_tabs->len_freq_table, 
+                                       freq_tabs->len_freq_table,
                                        codes->len_lens,
                                        codes->len_codewords);
 
        make_canonical_huffman_code(LZX_ALIGNEDTREE_NUM_SYMBOLS, 8,
-                                       freq_tabs->aligned_freq_table, 
+                                       freq_tabs->aligned_freq_table,
                                        codes->aligned_lens,
                                        codes->aligned_codewords);
 }
@@ -566,7 +566,7 @@ static void lzx_make_huffman_codes(const struct lzx_freq_tables *freq_tabs,
  * no bit to indicate that it actually is used, unlike in the LZX compressed
  * format as used in other file formats such as the cabinet format, where a bit
  * is reserved for that purpose. */
-static void do_call_insn_preprocessing(u8 uncompressed_data[], 
+static void do_call_insn_preprocessing(u8 uncompressed_data[],
                                                uint uncompressed_data_len)
 {
        int i = 0;
@@ -576,7 +576,7 @@ static void do_call_insn_preprocessing(u8 uncompressed_data[],
 
        /* Not enabled in the last 6 bytes, which means the 5-byte call
         * instruction cannot start in the last *10* bytes. */
-       while (i < uncompressed_data_len - 10) { 
+       while (i < uncompressed_data_len - 10) {
                if (uncompressed_data[i] != 0xe8) {
                        i++;
                        continue;
@@ -612,7 +612,7 @@ static const struct lz_params lzx_lz_params = {
        .too_far        = 4096,
 };
 
-/* 
+/*
  * Performs LZX compression on a block of data.
  *
  * @__uncompressed_data:  Pointer to the data to be compressed.
@@ -627,7 +627,7 @@ static const struct lz_params lzx_lz_params = {
  * @compressed_data and @compressed_len_ret will contain the compressed data and
  * its length.  A return value of nonzero means that compressing the data did
  * not reduce its size, and @compressed_data will not contain the full
- * compressed data. 
+ * compressed data.
  */
 int lzx_compress(const void *__uncompressed_data, uint uncompressed_len,
                 void *compressed_data, uint *compressed_len_ret)
@@ -703,21 +703,21 @@ int lzx_compress(const void *__uncompressed_data, uint uncompressed_len,
 
        /* Write the pre-tree and lengths for the first LZX_NUM_CHARS symbols in the
         * main tree. */
-       ret = lzx_write_compressed_tree(&ostream, codes.main_lens, 
+       ret = lzx_write_compressed_tree(&ostream, codes.main_lens,
                                        LZX_NUM_CHARS);
        if (ret != 0)
                return ret;
 
        /* Write the pre-tree and symbols for the rest of the main tree. */
-       ret = lzx_write_compressed_tree(&ostream, codes.main_lens + 
-                                       LZX_NUM_CHARS, 
-                                       LZX_MAINTREE_NUM_SYMBOLS - 
+       ret = lzx_write_compressed_tree(&ostream, codes.main_lens +
+                                       LZX_NUM_CHARS,
+                                       LZX_MAINTREE_NUM_SYMBOLS -
                                                LZX_NUM_CHARS);
        if (ret != 0)
                return ret;
 
        /* Write the pre-tree and symbols for the length tree. */
-       ret = lzx_write_compressed_tree(&ostream, codes.len_lens, 
+       ret = lzx_write_compressed_tree(&ostream, codes.len_lens,
                                        LZX_LENTREE_NUM_SYMBOLS);
        if (ret != 0)
                return ret;
@@ -743,7 +743,7 @@ int lzx_compress(const void *__uncompressed_data, uint uncompressed_len,
        /* Verify that we really get the same thing back when decompressing. */
        LZX_DEBUG("Verifying the compressed data.");
        u8 buf[uncompressed_len];
-       ret = lzx_decompress(compressed_data, compressed_len, buf, 
+       ret = lzx_decompress(compressed_data, compressed_len, buf,
                             uncompressed_len);
        if (ret != 0) {
                ERROR("lzx_compress(): Failed to decompress data we compressed");
index 5fa38049e2afede25267d3a69de2cdba45b0acd8..92bfb2e9413413a32a6e297878ec4369a8b23d81 100644 (file)
@@ -25,7 +25,7 @@
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
-/* 
+/*
  * This file has been modified from code taken from cabextract v0.5, which was,
  * itself, a modified version of the lzx decompression code from unlzx.  The
  * code has been customized for wimlib.
@@ -68,7 +68,7 @@
  *
  */
 
-/* 
+/*
  * Some more notes about errors in Microsoft's documentation:
  *
  * Microsoft's LZX document and their implementation of the com.ms.util.cab Java
 /* Huffman decoding tables and maps from symbols to code lengths. */
 struct lzx_tables {
 
-       u16 maintree_decode_table[(1 << LZX_MAINTREE_TABLEBITS) + 
+       u16 maintree_decode_table[(1 << LZX_MAINTREE_TABLEBITS) +
                                        (LZX_MAINTREE_NUM_SYMBOLS * 2)];
        u8 maintree_lens[LZX_MAINTREE_NUM_SYMBOLS];
 
 
-       u16 lentree_decode_table[(1 << LZX_LENTREE_TABLEBITS) + 
+       u16 lentree_decode_table[(1 << LZX_LENTREE_TABLEBITS) +
                                        (LZX_LENTREE_NUM_SYMBOLS * 2)];
        u8 lentree_lens[LZX_LENTREE_NUM_SYMBOLS];
 
 
-       u16 alignedtree_decode_table[(1 << LZX_ALIGNEDTREE_TABLEBITS) + 
+       u16 alignedtree_decode_table[(1 << LZX_ALIGNEDTREE_TABLEBITS) +
                                        (LZX_ALIGNEDTREE_NUM_SYMBOLS * 2)];
        u8 alignedtree_lens[LZX_ALIGNEDTREE_NUM_SYMBOLS];
 };
 
 
-/* 
- * Reads a Huffman-encoded symbol using the pre-tree. 
+/*
+ * Reads a Huffman-encoded symbol using the pre-tree.
  */
-static inline int read_huffsym_using_pretree(struct input_bitstream *istream, 
+static inline int read_huffsym_using_pretree(struct input_bitstream *istream,
                                             const u16 pretree_decode_table[],
                                             const u8 pretree_lens[], uint *n)
 {
-       return read_huffsym(istream, pretree_decode_table, pretree_lens, 
+       return read_huffsym(istream, pretree_decode_table, pretree_lens,
                            LZX_PRETREE_NUM_SYMBOLS, LZX_PRETREE_TABLEBITS, n,
                            LZX_MAX_CODEWORD_LEN);
 }
 
 /* Reads a Huffman-encoded symbol using the main tree. */
-static inline int read_huffsym_using_maintree(struct input_bitstream *istream, 
-                                             const struct lzx_tables *tables, 
+static inline int read_huffsym_using_maintree(struct input_bitstream *istream,
+                                             const struct lzx_tables *tables,
                                              uint *n)
 {
-       return read_huffsym(istream, tables->maintree_decode_table, 
+       return read_huffsym(istream, tables->maintree_decode_table,
                            tables->maintree_lens, LZX_MAINTREE_NUM_SYMBOLS,
                            LZX_MAINTREE_TABLEBITS, n, LZX_MAX_CODEWORD_LEN);
 }
 
 /* Reads a Huffman-encoded symbol using the length tree. */
-static inline int read_huffsym_using_lentree(struct input_bitstream *istream, 
-                                            const struct lzx_tables *tables, 
+static inline int read_huffsym_using_lentree(struct input_bitstream *istream,
+                                            const struct lzx_tables *tables,
                                             uint *n)
 {
-       return read_huffsym(istream, tables->lentree_decode_table, 
-                           tables->lentree_lens, LZX_LENTREE_NUM_SYMBOLS, 
+       return read_huffsym(istream, tables->lentree_decode_table,
+                           tables->lentree_lens, LZX_LENTREE_NUM_SYMBOLS,
                            LZX_LENTREE_TABLEBITS, n, LZX_MAX_CODEWORD_LEN);
 }
 
 /* Reads a Huffman-encoded symbol using the aligned offset tree. */
-static inline int read_huffsym_using_alignedtree(struct input_bitstream *istream, 
-                                                const struct lzx_tables *tables, 
+static inline int read_huffsym_using_alignedtree(struct input_bitstream *istream,
+                                                const struct lzx_tables *tables,
                                                 uint *n)
 {
-       return read_huffsym(istream, tables->alignedtree_decode_table, 
+       return read_huffsym(istream, tables->alignedtree_decode_table,
                            tables->alignedtree_lens,
-                           LZX_ALIGNEDTREE_NUM_SYMBOLS, 
+                           LZX_ALIGNEDTREE_NUM_SYMBOLS,
                            LZX_ALIGNEDTREE_TABLEBITS, n, 8);
 }
 
-/* 
+/*
  * Reads the pretree from the input, then uses the pretree to decode @num_lens
- * code length values from the input. 
+ * code length values from the input.
  *
  * @istream:   The bit stream for the input.  It is positioned on the beginning
  *                     of the pretree for the code length values.
  * @lens:      An array that contains the length values from the previous time
  *                     the code lengths for this Huffman tree were read, or all
- *                     0's if this is the first time.  
+ *                     0's if this is the first time.
  * @num_lens:  Number of length values to decode and return.
  *
  */
-static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[], 
+static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
                              uint num_lens)
 {
        /* Declare the decoding table and length table for the pretree. */
-       u16 pretree_decode_table[(1 << LZX_PRETREE_TABLEBITS) + 
+       u16 pretree_decode_table[(1 << LZX_PRETREE_TABLEBITS) +
                                        (LZX_PRETREE_NUM_SYMBOLS * 2)];
        u8 pretree_lens[LZX_PRETREE_NUM_SYMBOLS];
        uint i;
@@ -201,7 +201,7 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
        /* Read the code lengths of the pretree codes.  There are 20 lengths of
         * 4 bits each. */
        for (i = 0; i < LZX_PRETREE_NUM_SYMBOLS; i++) {
-               ret = bitstream_read_bits(istream, LZX_PRETREE_ELEMENT_SIZE, 
+               ret = bitstream_read_bits(istream, LZX_PRETREE_ELEMENT_SIZE,
                                          &len);
                if (ret != 0)
                        return ret;
@@ -209,10 +209,10 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
        }
 
        /* Make the decoding table for the pretree. */
-       ret = make_huffman_decode_table(pretree_decode_table, 
-                                       LZX_PRETREE_NUM_SYMBOLS, 
-                                       LZX_PRETREE_TABLEBITS, 
-                                       pretree_lens, 
+       ret = make_huffman_decode_table(pretree_decode_table,
+                                       LZX_PRETREE_NUM_SYMBOLS,
+                                       LZX_PRETREE_TABLEBITS,
+                                       pretree_lens,
                                        LZX_MAX_CODEWORD_LEN);
        if (ret != 0)
                return ret;
@@ -230,11 +230,11 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
                 * input. */
                uint tree_code;
                uint num_zeroes;
-               uint code; 
+               uint code;
                uint num_same;
                char value;
 
-               ret = read_huffsym_using_pretree(istream, pretree_decode_table, 
+               ret = read_huffsym_using_pretree(istream, pretree_decode_table,
                                                pretree_lens, &tree_code);
                if (ret != 0)
                        return ret;
@@ -267,8 +267,8 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
                                return ret;
                        num_same += 4;
 
-                       ret = read_huffsym_using_pretree(istream, 
-                                               pretree_decode_table, 
+                       ret = read_huffsym_using_pretree(istream,
+                                               pretree_decode_table,
                                                pretree_lens, &code);
                        if (ret != 0)
                                return ret;
@@ -293,7 +293,7 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
        }
 }
 
-/* 
+/*
  * Reads the header for an LZX-compressed block.
  *
  * @istream:           The input bitstream.
@@ -301,16 +301,16 @@ static int lzx_read_code_lens(struct input_bitstream *istream, u8 lens[],
  *                             in bytes, will be returned.
  * @block_type_ret:    A pointer to an int into which the type of the block
  *                             (LZX_BLOCKTYPE_*) will be returned.
- * @tables:            A pointer to a lzx_tables structure in which the 
+ * @tables:            A pointer to a lzx_tables structure in which the
  *                             main tree, the length tree, and possibly the
  *                             aligned offset tree will be constructed.
  * @queue:     A pointer to the least-recently-used queue into which
  *                     R0, R1, and R2 will be written (only for uncompressed
  *                     blocks, which contain this information in the header)
  */
-static int lzx_read_block_header(struct input_bitstream *istream, 
-                                int *block_size_ret, int *block_type_ret, 
-                                struct lzx_tables *tables, 
+static int lzx_read_block_header(struct input_bitstream *istream,
+                                int *block_size_ret, int *block_type_ret,
+                                struct lzx_tables *tables,
                                 struct lru_queue *queue)
 {
        int ret;
@@ -351,17 +351,17 @@ static int lzx_read_block_header(struct input_bitstream *istream,
                 * then build it. */
 
                for (i = 0; i < LZX_ALIGNEDTREE_NUM_SYMBOLS; i++) {
-                       ret = bitstream_read_bits(istream, 
-                                                 LZX_ALIGNEDTREE_ELEMENT_SIZE, 
+                       ret = bitstream_read_bits(istream,
+                                                 LZX_ALIGNEDTREE_ELEMENT_SIZE,
                                                  &len);
                        if (ret != 0)
                                return ret;
                        tables->alignedtree_lens[i] = len;
                }
-               
+
                LZX_DEBUG("Building the aligned tree.");
                ret = make_huffman_decode_table(tables->alignedtree_decode_table,
-                                               LZX_ALIGNEDTREE_NUM_SYMBOLS, 
+                                               LZX_ALIGNEDTREE_NUM_SYMBOLS,
                                                LZX_ALIGNEDTREE_TABLEBITS,
                                                tables->alignedtree_lens,
                                                8);
@@ -381,7 +381,7 @@ static int lzx_read_block_header(struct input_bitstream *istream,
                LZX_DEBUG("Reading path lengths for main tree.");
                /* Read the path lengths for the first 256 elements of the main
                 * tree. */
-               ret = lzx_read_code_lens(istream, tables->maintree_lens, 
+               ret = lzx_read_code_lens(istream, tables->maintree_lens,
                                         LZX_NUM_CHARS);
                if (ret != 0) {
                        ERROR("lzx_decompress(): Failed to read the code "
@@ -395,8 +395,8 @@ static int lzx_read_block_header(struct input_bitstream *istream,
                LZX_DEBUG("Reading path lengths for remaining elements of "
                          "main tree (%d elements).",
                          LZX_MAINTREE_NUM_SYMBOLS - LZX_NUM_CHARS);
-               ret = lzx_read_code_lens(istream, 
-                                        tables->maintree_lens + LZX_NUM_CHARS, 
+               ret = lzx_read_code_lens(istream,
+                                        tables->maintree_lens + LZX_NUM_CHARS,
                                         LZX_MAINTREE_NUM_SYMBOLS - LZX_NUM_CHARS);
                if (ret != 0) {
                        ERROR("lzx_decompress(): Failed to read the path "
@@ -411,7 +411,7 @@ static int lzx_read_block_header(struct input_bitstream *istream,
                ret = make_huffman_decode_table(tables->maintree_decode_table,
                                                LZX_MAINTREE_NUM_SYMBOLS,
                                                LZX_MAINTREE_TABLEBITS,
-                                               tables->maintree_lens, 
+                                               tables->maintree_lens,
                                                LZX_MAX_CODEWORD_LEN);
                if (ret != 0) {
                        ERROR("lzx_decompress(): Failed to make the decode "
@@ -420,7 +420,7 @@ static int lzx_read_block_header(struct input_bitstream *istream,
                }
 
                LZX_DEBUG("Reading path lengths for the length tree.");
-               ret = lzx_read_code_lens(istream, tables->lentree_lens, 
+               ret = lzx_read_code_lens(istream, tables->lentree_lens,
                                         LZX_LENTREE_NUM_SYMBOLS);
                if (ret != 0) {
                        ERROR("lzx_decompress(): Failed to read the path "
@@ -430,9 +430,9 @@ static int lzx_read_block_header(struct input_bitstream *istream,
 
                LZX_DEBUG("Building the length tree.");
                ret = make_huffman_decode_table(tables->lentree_decode_table,
-                                               LZX_LENTREE_NUM_SYMBOLS, 
+                                               LZX_LENTREE_NUM_SYMBOLS,
                                                LZX_LENTREE_TABLEBITS,
-                                               tables->lentree_lens, 
+                                               tables->lentree_lens,
                                                LZX_MAX_CODEWORD_LEN);
                if (ret != 0) {
                        ERROR("lzx_decompress(): Failed to build the length "
@@ -463,7 +463,7 @@ static int lzx_read_block_header(struct input_bitstream *istream,
        return 0;
 }
 
-/* 
+/*
  * Decodes a compressed literal match value.  It refers to some match_offset to
  * a point earlier in the window, and some match_len, for which the data is to
  * be copied to the current position in the window.
@@ -488,10 +488,10 @@ static int lzx_read_block_header(struct input_bitstream *istream,
  * the amount of data needing to be uncompressed, or match refers to data before
  * the window, or the input bitstream ended unexpectedly).
  */
-static int lzx_decode_match(int main_element, int block_type, 
-                           int bytes_remaining, u8 *window, int window_pos, 
-                           const struct lzx_tables *tables, 
-                           struct lru_queue *queue, 
+static int lzx_decode_match(int main_element, int block_type,
+                           int bytes_remaining, u8 *window, int window_pos,
+                           const struct lzx_tables *tables,
+                           struct lru_queue *queue,
                            struct input_bitstream *istream)
 {
        uint length_header;
@@ -522,7 +522,7 @@ static int lzx_decode_match(int main_element, int block_type,
         * tree, offset by 9 (LZX_MIN_MATCH + LZX_NUM_PRIMARY_LENS) */
        match_len = LZX_MIN_MATCH + length_header;
        if (length_header == LZX_NUM_PRIMARY_LENS) {
-               ret = read_huffsym_using_lentree(istream, tables, 
+               ret = read_huffsym_using_lentree(istream, tables,
                                                &additional_len);
                if (ret != 0)
                        return -1;
@@ -571,14 +571,14 @@ static int lzx_decode_match(int main_element, int block_type,
                         * equal to 3.  (Note that in the case with
                         * num_extra_bits == 3, the assignment to verbatim_bits
                         * will just set it to 0. ) */
-                       ret = bitstream_read_bits(istream, num_extra_bits - 3, 
+                       ret = bitstream_read_bits(istream, num_extra_bits - 3,
                                                                &verbatim_bits);
                        if (ret != 0)
                                return -1;
 
                        verbatim_bits <<= 3;
 
-                       ret = read_huffsym_using_alignedtree(istream, tables, 
+                       ret = read_huffsym_using_alignedtree(istream, tables,
                                                             &aligned_bits);
                        if (ret != 0)
                                return -1;
@@ -587,7 +587,7 @@ static int lzx_decode_match(int main_element, int block_type,
                         * less than 3 extra bits, the extra bits are added
                         * directly to the match offset, and the correction for
                         * the alignment is taken to be 0. */
-                       ret = bitstream_read_bits(istream, num_extra_bits, 
+                       ret = bitstream_read_bits(istream, num_extra_bits,
                                                  &verbatim_bits);
                        if (ret != 0)
                                return -1;
@@ -596,7 +596,7 @@ static int lzx_decode_match(int main_element, int block_type,
                }
 
                /* Calculate the match offset. */
-               match_offset = lzx_position_base[position_slot] + verbatim_bits + 
+               match_offset = lzx_position_base[position_slot] + verbatim_bits +
                                                        aligned_bits - 2;
 
                /* Update the LRU queue. */
@@ -653,7 +653,7 @@ static int lzx_decode_match(int main_element, int block_type,
  * no bit to indicate that it actually is used, unlike in the LZX compressed
  * format as used in other file formats, where a bit is reserved for that
  * purpose. */
-static void undo_call_insn_preprocessing(u8 uncompressed_data[], 
+static void undo_call_insn_preprocessing(u8 uncompressed_data[],
                                         uint uncompressed_data_len)
 {
        int i = 0;
@@ -663,7 +663,7 @@ static void undo_call_insn_preprocessing(u8 uncompressed_data[],
 
        /* Not enabled in the last 6 bytes, which means the 5-byte call
         * instruction cannot start in the last *10* bytes. */
-       while (i < uncompressed_data_len - 10) { 
+       while (i < uncompressed_data_len - 10) {
                if (uncompressed_data[i] != 0xe8) {
                        i++;
                        continue;
@@ -678,14 +678,14 @@ static void undo_call_insn_preprocessing(u8 uncompressed_data[],
                                /* "compensating translation" */
                                rel_offset = abs_offset + file_size;
                        }
-                       *(int32_t*)(uncompressed_data + i + 1) = 
+                       *(int32_t*)(uncompressed_data + i + 1) =
                                                cpu_to_le32(rel_offset);
                }
                i += 5;
        }
 }
 
-/* 
+/*
  * Decompresses a compressed block of data from which the header has already
  * been read.
  *
@@ -694,16 +694,16 @@ static void undo_call_insn_preprocessing(u8 uncompressed_data[],
  * @block_size:        The size of the block, in bytes.
  * @window:    Pointer to the decompression window.
  * @window_pos:        The current position in the window.  Will be 0 for the first
- *                     block.  
+ *                     block.
  * @tables:    The Huffman decoding tables for the block (main, length, and
  *                     aligned offset, the latter only for LZX_BLOCKTYPE_ALIGNED)
  * @queue:     The least-recently-used queue for match offsets.
  * @istream:   The input bitstream for the compressed literals.
  */
-static int lzx_decompress_block(int block_type, int block_size, u8 *window, 
-                               int window_pos, 
-                               const struct lzx_tables *tables, 
-                               struct lru_queue *queue, 
+static int lzx_decompress_block(int block_type, int block_size, u8 *window,
+                               int window_pos,
+                               const struct lzx_tables *tables,
+                               struct lru_queue *queue,
                                struct input_bitstream *istream)
 {
        uint bytes_remaining;
@@ -714,21 +714,21 @@ static int lzx_decompress_block(int block_type, int block_size, u8 *window,
        bytes_remaining = block_size;
        while (bytes_remaining > 0) {
 
-               ret = read_huffsym_using_maintree(istream, tables, 
+               ret = read_huffsym_using_maintree(istream, tables,
                                                  &main_element);
                if (ret != 0)
                        return ret;
 
                if (main_element < LZX_NUM_CHARS) {
                        /* literal: 0 to LZX_NUM_CHARS - 1 */
-                       window[window_pos + block_size - bytes_remaining] = 
+                       window[window_pos + block_size - bytes_remaining] =
                                                        main_element;
                        bytes_remaining--;
                } else {
                        /* match: LZX_NUM_CHARS to LZX_MAINTREE_NUM_SYMBOLS - 1 */
-                       match_len = lzx_decode_match(main_element, 
+                       match_len = lzx_decode_match(main_element,
                                                block_type, bytes_remaining, window,
-                                               block_size + window_pos - 
+                                               block_size + window_pos -
                                                        bytes_remaining,
                                                tables, queue, istream);
                        if (match_len == -1)
@@ -740,18 +740,18 @@ static int lzx_decompress_block(int block_type, int block_size, u8 *window,
        return 0;
 }
 
-/* 
+/*
  * Decompresses a block of LZX-compressed data using a window size of 32768.
  *
  * @compressed_data:   A pointer to the compressed data.
- * @compressed_len:    The length of the compressed data, in bytes.  
+ * @compressed_len:    The length of the compressed data, in bytes.
  * @uncompressed_data: A pointer to the buffer into which to write the
  *                             uncompressed data.
  * @uncompressed_len:  The length of the uncompressed data.
  *
  * Return non-zero on failure.
  */
-int lzx_decompress(const void *compressed_data, uint compressed_len, 
+int lzx_decompress(const void *compressed_data, uint compressed_len,
                   void *uncompressed_data, uint uncompressed_len)
 {
        struct lzx_tables       tables;
@@ -786,7 +786,7 @@ int lzx_decompress(const void *compressed_data, uint compressed_len,
        while (bytes_remaining != 0) {
 
                LZX_DEBUG("Reading block header.");
-               ret = lzx_read_block_header(&istream, &block_size, &block_type, 
+               ret = lzx_read_block_header(&istream, &block_size, &block_type,
                                                        &tables, &queue);
                if (ret != 0)
                        return ret;
@@ -809,20 +809,20 @@ int lzx_decompress(const void *compressed_data, uint compressed_len,
                        else
                                LZX_DEBUG("LZX_BLOCKTYPE_ALIGNED");
 
-                       ret = lzx_decompress_block(block_type, 
+                       ret = lzx_decompress_block(block_type,
                                                   block_size,
                                                   uncompressed_data,
                                                   uncompressed_len -
-                                                      bytes_remaining, 
+                                                      bytes_remaining,
                                                   &tables, &queue, &istream);
                        if (ret != 0)
                                return ret;
                        break;
                case LZX_BLOCKTYPE_UNCOMPRESSED:
                        LZX_DEBUG("LZX_BLOCKTYPE_UNCOMPRESSED");
-                       ret = bitstream_read_bytes(&istream, block_size, 
-                                                  uncompressed_data + 
-                                                  uncompressed_len - 
+                       ret = bitstream_read_bytes(&istream, block_size,
+                                                  uncompressed_data +
+                                                  uncompressed_len -
                                                   bytes_remaining);
                        if (ret != 0)
                                return ret;
index b44fecffb74c0c1710923bb45b75e5699a257703..027186976b675842650c0f810067fa719e8973e9 100644 (file)
--- a/src/lzx.h
+++ b/src/lzx.h
@@ -40,7 +40,7 @@
  * read_code_lens() function and built using the make_decode_table() function.
  * The decode table is not a real tree but rather a table that we can index by
  * some number of bits (*_TABLEBITS) of the input to quickly look up the symbol
- * corresponding to a Huffman code. 
+ * corresponding to a Huffman code.
  *
  * The ALIGNED tree is only present on ALIGNED blocks.
  *
@@ -83,7 +83,7 @@ struct lru_queue {
        int R2;
 };
 
-extern int lzx_decompress(const void *compressed_data, uint compressed_len, 
+extern int lzx_decompress(const void *compressed_data, uint compressed_len,
                          void *uncompressed_data, uint uncompressed_len);
 
 extern int lzx_compress(const void *uncompressed_data, uint uncompressed_len,
index 775312c6b92b714dcd58729fca4dc32e4dab0e4a..76049d8df437ddf8769b2eb5153042d14dc4b24a 100644 (file)
@@ -202,7 +202,7 @@ static int build_dentry_tree(struct dentry **root_ret,
        } else if (dentry_is_symlink(root)) { /* Archiving a symbolic link */
                char deref_name_buf[4096];
                ssize_t deref_name_len;
-       
+
                deref_name_len = readlink(root_disk_path, deref_name_buf,
                                          sizeof(deref_name_buf) - 1);
                if (deref_name_len >= 0) {
@@ -760,7 +760,7 @@ static int init_capture_config(const char *_config_str, size_t config_len,
                        ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
                        goto out_destroy;
                }
-       
+
                next_p = eol + 1;
                bytes_remaining -= (next_p - p);
                if (eol == p)
index f2dad8d3714d945726d4e9c35f4d767cdfa06a4e..fa30aaeae255a0e9aa885cea62e59a629e16e914 100644 (file)
@@ -130,7 +130,7 @@ static int alloc_wimlib_fd(struct inode *inode,
                        return -EMFILE;
                num_new_fds = min(fds_per_alloc,
                                  max_fds - inode->num_allocated_fds);
-               
+
                fds = REALLOC(inode->fds,
                              (inode->num_allocated_fds + num_new_fds) *
                                sizeof(inode->fds[0]));
@@ -286,7 +286,7 @@ static int create_staging_file(char **name_ret, int open_flags)
 
        DEBUG("Creating staging file `%s'", name);
 
-       fd = open(name, open_flags | O_CREAT | O_TRUNC, 0600); 
+       fd = open(name, open_flags | O_CREAT | O_TRUNC, 0600);
        if (fd == -1) {
                errno_save = errno;
                FREE(name);
@@ -297,7 +297,7 @@ static int create_staging_file(char **name_ret, int open_flags)
        return fd;
 }
 
-/* 
+/*
  * Extract a WIM resource to the staging directory.
  *
  * @inode:  Inode that contains the stream we are extracting
@@ -377,7 +377,7 @@ static int extract_resource_to_staging_dir(struct inode *inode,
                 * opening it read-write.  Identify those file descriptors and
                 * change their lookup table entry pointers to point to the new
                 * lookup table entry, and open staging file descriptors for
-                * them. 
+                * them.
                 *
                 * At the same time, we need to count the number of these opened
                 * file descriptors to the new lookup table entry.  If there's
@@ -446,7 +446,7 @@ out_delete_staging_file:
        return ret;
 }
 
-/* 
+/*
  * Creates a randomly named staging directory and returns its name into the
  * static variable staging_dir_name.
  *
@@ -495,13 +495,13 @@ static int remove_file_or_directory(const char *fpath, const struct stat *sb,
 }
 
 
-/* 
- * Deletes the staging directory and all the files contained in it. 
+/*
+ * Deletes the staging directory and all the files contained in it.
  */
 static int delete_staging_dir()
 {
        int ret;
-       
+
        ret = nftw(staging_dir_name, remove_file_or_directory,10, FTW_DEPTH);
        staging_dir_name = NULL;
        return ret;
@@ -519,7 +519,7 @@ static mqd_t unmount_to_daemon_mq;
 static mqd_t daemon_to_unmount_mq;
 
 /* Simple function that returns the concatenation of 4 strings. */
-static char *strcat_dup(const char *s1, const char *s2, const char *s3, 
+static char *strcat_dup(const char *s1, const char *s2, const char *s3,
                        const char *s4)
 {
        size_t len = strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) + 1;
@@ -554,7 +554,7 @@ static void s_slashes_underscores_g(char *s)
        }
 }
 
-/* 
+/*
  * Opens two POSIX message queue: one for sending messages from the unmount
  * process to the daemon process, and one to go the other way.  The names of the
  * message queues, which must be system-wide unique, are be based on the mount
@@ -599,7 +599,7 @@ static int open_message_queues(bool daemon)
        else
                flags = O_WRONLY | O_CREAT;
 
-       unmount_to_daemon_mq = mq_open(unmount_to_daemon_mq_name, flags, 
+       unmount_to_daemon_mq = mq_open(unmount_to_daemon_mq_name, flags,
                                       0700, NULL);
 
        if (unmount_to_daemon_mq == (mqd_t)-1) {
@@ -613,7 +613,7 @@ static int open_message_queues(bool daemon)
        else
                flags = O_RDONLY | O_CREAT;
 
-       daemon_to_unmount_mq = mq_open(daemon_to_unmount_mq_name, flags, 
+       daemon_to_unmount_mq = mq_open(daemon_to_unmount_mq_name, flags,
                                       0700, NULL);
 
        if (daemon_to_unmount_mq == (mqd_t)-1) {
@@ -820,7 +820,7 @@ static void wimfs_destroy(void *p)
        DEBUG("Waiting for message telling us whether to commit or not, and "
              "whether to include integrity checks.");
 
-       bytes_received = mq_timedreceive(unmount_to_daemon_mq, msg, 
+       bytes_received = mq_timedreceive(unmount_to_daemon_mq, msg,
                                         msgsize, NULL, &timeout);
        commit = msg[0];
        check_integrity = msg[1];
@@ -1034,8 +1034,8 @@ static int wimfs_listxattr(const char *path, char *list, size_t size)
 }
 #endif
 
-/* 
- * Create a directory in the WIM.  
+/*
+ * Create a directory in the WIM.
  * @mode is currently ignored.
  */
 static int wimfs_mkdir(const char *path, mode_t mode)
@@ -1043,7 +1043,7 @@ static int wimfs_mkdir(const char *path, mode_t mode)
        struct dentry *parent;
        struct dentry *newdir;
        const char *basename;
-       
+
        parent = get_parent_dentry(w, path);
        if (!parent)
                return -ENOENT;
@@ -1176,7 +1176,7 @@ static int wimfs_opendir(const char *path, struct fuse_file_info *fi)
        struct inode *inode;
        int ret;
        struct wimlib_fd *fd = NULL;
-       
+
        inode = wim_pathname_to_inode(w, path);
        if (!inode)
                return -ENOENT;
@@ -1189,9 +1189,9 @@ static int wimfs_opendir(const char *path, struct fuse_file_info *fi)
 
 
 /*
- * Read data from a file in the WIM or in the staging directory. 
+ * Read data from a file in the WIM or in the staging directory.
  */
-static int wimfs_read(const char *path, char *buf, size_t size, 
+static int wimfs_read(const char *path, char *buf, size_t size,
                      off_t offset, struct fuse_file_info *fi)
 {
        struct wimlib_fd *fd = (struct wimlib_fd*)(uintptr_t)fi->fh;
@@ -1221,7 +1221,7 @@ static int wimfs_read(const char *path, char *buf, size_t size,
                /* Read from WIM */
 
                u64 res_size = wim_resource_size(fd->f_lte);
-               
+
                if (offset > res_size)
                        return -EOVERFLOW;
 
@@ -1236,7 +1236,7 @@ static int wimfs_read(const char *path, char *buf, size_t size,
 
 /* Fills in the entries of the directory specified by @path using the
  * FUSE-provided function @filler.  */
-static int wimfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, 
+static int wimfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
                         off_t offset, struct fuse_file_info *fi)
 {
        struct wimlib_fd *fd = (struct wimlib_fd*)(uintptr_t)fi->fh;
@@ -1332,7 +1332,7 @@ static int wimfs_rename(const char *from, const char *to)
 
        /* This rename() implementation currently only supports actual files
         * (not alternate data streams) */
-       
+
        src = get_dentry(w, from);
        if (!src)
                return -ENOENT;
@@ -1392,7 +1392,7 @@ static int wimfs_rename(const char *from, const char *to)
 static int wimfs_rmdir(const char *path)
 {
        struct dentry *dentry;
-       
+
        dentry = get_dentry(w, path);
        if (!dentry)
                return -ENOENT;
@@ -1477,7 +1477,7 @@ static int wimfs_symlink(const char *to, const char *from)
        struct dentry *dentry_parent, *dentry;
        const char *link_name;
        struct inode *inode;
-       
+
        dentry_parent = get_parent_dentry(w, from);
        if (!dentry_parent)
                return -ENOENT;
@@ -1518,7 +1518,7 @@ static int wimfs_truncate(const char *path, off_t size)
        u16 stream_idx;
        u32 stream_id;
        struct inode *inode;
-       
+
        ret = lookup_resource(w, path, get_lookup_flags(), &dentry,
                              &lte, &stream_idx);
 
@@ -1560,7 +1560,7 @@ static int wimfs_unlink(const char *path)
        int ret;
        u16 stream_idx;
        unsigned i;
-       
+
        ret = lookup_resource(w, path, get_lookup_flags(), &dentry,
                              &lte, &stream_idx);
 
@@ -1575,8 +1575,8 @@ static int wimfs_unlink(const char *path)
 }
 
 #ifdef HAVE_UTIMENSAT
-/* 
- * Change the timestamp on a file dentry. 
+/*
+ * Change the timestamp on a file dentry.
  *
  * Note that alternate data streams do not have their own timestamps.
  */
@@ -1619,10 +1619,10 @@ static int wimfs_utime(const char *path, struct utimbuf *times)
 }
 #endif
 
-/* Writes to a file in the WIM filesystem. 
+/* Writes to a file in the WIM filesystem.
  * It may be an alternate data stream, but here we don't even notice because we
  * just get a lookup table entry. */
-static int wimfs_write(const char *path, const char *buf, size_t size, 
+static int wimfs_write(const char *path, const char *buf, size_t size,
                       off_t offset, struct fuse_file_info *fi)
 {
        struct wimlib_fd *fd = (struct wimlib_fd*)(uintptr_t)fi->fh;
@@ -1698,7 +1698,7 @@ static struct fuse_operations wimfs_operations = {
 
 
 /* Mounts a WIM file. */
-WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir, 
+WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir,
                           int flags, WIMStruct **additional_swms,
                           unsigned num_additional_swms)
 {
@@ -1796,7 +1796,7 @@ WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir,
        if (flags & WIMLIB_MOUNT_FLAG_DEBUG)
                argv[argc++] = "-d";
 
-       /* 
+       /*
         * We provide the use_ino option because we are going to assign inode
         * numbers oursides.  We've already numbered the inodes with unique
         * numbers in the assign_inode_numbers() function, and the static
@@ -1848,7 +1848,7 @@ out:
 }
 
 
-/* 
+/*
  * Unmounts the WIM file that was previously mounted on @dir by using
  * wimlib_mount().
  */
@@ -1876,7 +1876,7 @@ WIMLIBAPI int wimlib_unmount(const char *dir, int flags)
        msg[0] = (flags & WIMLIB_UNMOUNT_FLAG_COMMIT) ? 1 : 0;
        msg[1] = (flags & WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY) ? 1 : 0;
 
-       DEBUG("Sending message: %s, %s", 
+       DEBUG("Sending message: %s, %s",
                        (msg[0] == 0) ? "don't commit" : "commit",
                        (msg[1] == 0) ? "don't check"  : "check");
        ret = mq_send(unmount_to_daemon_mq, msg, 2, 1);
@@ -1896,7 +1896,7 @@ WIMLIBAPI int wimlib_unmount(const char *dir, int flags)
         * send a message from this process to the filesystem daemon telling
         * whether --commit was specified or not.  However, after that, the
         * unmount process must wait for the filesystem daemon to finish writing
-        * the WIM file. 
+        * the WIM file.
         */
 
 
@@ -1958,7 +1958,7 @@ WIMLIBAPI int wimlib_unmount(const char *dir, int flags)
         * filesystem daemon has crashed or failed for some reason.
         *
         * XXX come up with some method to determine if the filesystem
-        * daemon has really crashed or not. 
+        * daemon has really crashed or not.
         *
         * XXX Idea: have mount daemon write its PID into the WIM file header?
         * */
@@ -2011,7 +2011,7 @@ WIMLIBAPI int wimlib_unmount(const char *dir, int flags)
        return mount_unsupported_error();
 }
 
-WIMLIBAPI int wimlib_mount(WIMStruct *wim_p, int image, const char *dir, 
+WIMLIBAPI int wimlib_mount(WIMStruct *wim_p, int image, const char *dir,
                           int flags, WIMStruct **additional_swms,
                           unsigned num_additional_swms)
 {
index 91e364f07012a2f83330812672713cb0682677de..56b3e70128a4c3934abb1b0cef7c02d530ad95fd 100644 (file)
@@ -54,7 +54,7 @@ struct ntfs_apply_args {
        WIMStruct *w;
 };
 
-/* 
+/*
  * Extracts a WIM resource to a NTFS attribute.
  */
 static int
@@ -260,7 +260,7 @@ apply_file_attributes_and_security_data(ntfs_inode *ni,
        if (dentry->d_inode->security_id != -1) {
                const struct wim_security_data *sd;
                const char *descriptor;
-               
+
                sd = wim_const_security_data(w);
                wimlib_assert(dentry->d_inode->security_id < sd->num_entries);
                descriptor = sd->descriptors[dentry->d_inode->security_id];
@@ -270,7 +270,7 @@ apply_file_attributes_and_security_data(ntfs_inode *ni,
                ret = ntfs_xattr_system_setxattr(&ctx, XATTR_NTFS_ACL,
                                                 ni, dir_ni, descriptor,
                                                 sd->sizes[dentry->d_inode->security_id], 0);
-                               
+
                if (ret != 0) {
                        ERROR_WITH_ERRNO("Failed to set security data on `%s'",
                                        dentry->full_path_utf8);
@@ -327,7 +327,7 @@ static int apply_reparse_data(ntfs_inode *ni, const struct dentry *dentry,
 static int do_wim_apply_dentry_ntfs(struct dentry *dentry, ntfs_inode *dir_ni,
                                    WIMStruct *w);
 
-/* 
+/*
  * If @dentry is part of a hard link group, search for hard-linked dentries in
  * the same directory that have a nonempty DOS (short) filename.  There should
  * be exactly 0 or 1 such dentries.  If there is 1, extract that dentry first,
@@ -390,7 +390,7 @@ static int preapply_dentry_with_dos_name(struct dentry *dentry,
        return 0;
 }
 
-/* 
+/*
  * Applies a WIM dentry to a NTFS filesystem.
  *
  * @dentry:  The WIM dentry to apply
@@ -449,7 +449,7 @@ static int do_wim_apply_dentry_ntfs(struct dentry *dentry, ntfs_inode *dir_ni,
                }
        }
 
-       /* 
+       /*
         * Create a directory or file.
         *
         * Note: For symbolic links that are not directory junctions, pass
@@ -689,7 +689,7 @@ static int do_wim_apply_image_ntfs(WIMStruct *w, const char *device, int extract
        int ret;
        struct dentry *root;
        struct ntfs_apply_args args;
-       
+
        DEBUG("Mounting NTFS volume `%s'", device);
        vol = ntfs_mount(device, 0);
        if (!vol) {
@@ -729,7 +729,7 @@ out:
 }
 
 
-/* 
+/*
  * API entry point for applying a WIM image to a NTFS volume.
  *
  * Please note that this is a NTFS *volume* and not a directory.  The intention
index 9739d9e1a55fd3a0d674b5e2a6968301f4dfae22..47df4085777643bc5393c4338bd690acbb677366 100644 (file)
@@ -87,12 +87,12 @@ static void insert_sd_node(struct sd_node *new, struct sd_node *root)
        if (cmp < 0) {
                if (root->left)
                        insert_sd_node(new, root->left);
-               else 
+               else
                        root->left = new;
        } else if (cmp > 0) {
                if (root->right)
                        insert_sd_node(new, root->right);
-               else 
+               else
                        root->right = new;
        } else {
                wimlib_assert(0);
@@ -100,7 +100,7 @@ static void insert_sd_node(struct sd_node *new, struct sd_node *root)
 }
 
 /* Returns the security ID of the security data having a SHA1 message digest of
- * @hash in the security descriptor index tree rooted at @root. 
+ * @hash in the security descriptor index tree rooted at @root.
  *
  * If not found, return -1. */
 static int lookup_sd(const u8 hash[SHA1_HASH_SIZE], struct sd_node *root)
@@ -191,7 +191,7 @@ static inline ntfschar *attr_record_name(ATTR_RECORD *ar)
        return (ntfschar*)((u8*)ar + le16_to_cpu(ar->name_offset));
 }
 
-/* Calculates the SHA1 message digest of a NTFS attribute. 
+/* Calculates the SHA1 message digest of a NTFS attribute.
  *
  * @ni:  The NTFS inode containing the attribute.
  * @ar:         The ATTR_RECORD describing the attribute.
@@ -276,7 +276,7 @@ static int capture_ntfs_streams(struct dentry *dentry, ntfs_inode *ni,
                u64 data_size = ntfs_get_attribute_value_length(actx->attr);
                u64 name_length = actx->attr->name_length;
 
-               if (data_size == 0) { 
+               if (data_size == 0) {
                        if (errno != 0) {
                                ERROR_WITH_ERRNO("Failed to get size of attribute of "
                                                 "`%s'", path);
@@ -371,7 +371,7 @@ static int capture_ntfs_streams(struct dentry *dentry, ntfs_inode *ni,
                                goto out_free_lte;
 
                        wimlib_assert(new_ads_entry->stream_name_len == name_length * 2);
-                               
+
                        new_ads_entry->lte = lte;
                }
        }
@@ -660,7 +660,7 @@ static int build_dentry_tree_ntfs(struct dentry **root_p,
        ntfs_volume **ntfs_vol_p = extra_arg;
 
        DEBUG("Mounting NTFS volume `%s' read-only", device);
-       
+
        vol = ntfs_mount(device, MS_RDONLY);
        if (!vol) {
                ERROR_WITH_ERRNO("Failed to mount NTFS volume `%s' read-only",
index be9bd7ce5a56ccb5c5d1affabde744b9d8c99420..ffcd7530a35f5ab590ad4ac9cc226701d7c389a1 100644 (file)
 #endif
 
 
-/* 
+/*
  * Reads all or part of a compressed resource into an in-memory buffer.
  *
  * @fp:                The FILE* for the WIM file.
- * @resource_compressed_size:           The compressed size of the resource.  
+ * @resource_compressed_size:           The compressed size of the resource.
  * @resource_uncompressed_size:  The uncompressed size of the resource.
  * @resource_offset:            The offset of the start of the resource from
  *                                     the start of the stream @fp.
- * @resource_ctype:    The compression type of the resource. 
+ * @resource_ctype:    The compression type of the resource.
  * @len:               The number of bytes of uncompressed data to read from
  *                             the resource.
  * @offset:            The offset of the bytes to read within the uncompressed
@@ -65,9 +65,9 @@
  *
  * Returns zero on success, nonzero on failure.
  */
-static int read_compressed_resource(FILE *fp, u64 resource_compressed_size, 
-                                   u64 resource_uncompressed_size, 
-                                   u64 resource_offset, int resource_ctype, 
+static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
+                                   u64 resource_uncompressed_size,
+                                   u64 resource_offset, int resource_ctype,
                                    u64 len, u64 offset, u8  contents_ret[])
 {
 
@@ -98,7 +98,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
         * The chunk offsets are measured relative to the end of the chunk
         * table.  The first chunk is omitted from the table in the WIM file
         * because its offset is implicitly given by the fact that it directly
-        * follows the chunk table and therefore must have an offset of 0. 
+        * follows the chunk table and therefore must have an offset of 0.
         */
 
        /* Calculate how many chunks the resource conists of in its entirety. */
@@ -146,7 +146,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
        /* According to M$'s documentation, if the uncompressed size of
         * the file is greater than 4 GB, the chunk entries are 8-byte
         * integers.  Otherwise, they are 4-byte integers. */
-       u64 chunk_entry_size = (resource_uncompressed_size >= (u64)1 << 32) ? 
+       u64 chunk_entry_size = (resource_uncompressed_size >= (u64)1 << 32) ?
                                                                        8 : 4;
 
        /* Size of the full chunk table in the WIM file. */
@@ -160,11 +160,11 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
 
        /* Number of entries we need to actually read from the chunk
         * table (excludes the implicit first chunk). */
-       u64 num_needed_chunk_entries = (start_chunk == 0) ? 
+       u64 num_needed_chunk_entries = (start_chunk == 0) ?
                                num_needed_chunks - 1 : num_needed_chunks;
 
        /* Skip over unneeded chunk table entries. */
-       u64 file_offset_of_needed_chunk_entries = resource_offset + 
+       u64 file_offset_of_needed_chunk_entries = resource_offset +
                                start_table_idx * chunk_entry_size;
        if (fseeko(fp, file_offset_of_needed_chunk_entries, SEEK_SET) != 0) {
                ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" to read "
@@ -201,7 +201,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
        /* Done with the chunk table now.  We must now seek to the first chunk
         * that is needed for the read. */
 
-       u64 file_offset_of_first_needed_chunk = resource_offset + 
+       u64 file_offset_of_first_needed_chunk = resource_offset +
                                chunk_table_size + chunk_offsets[0];
        if (fseeko(fp, file_offset_of_first_needed_chunk, SEEK_SET) != 0) {
                ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" to read "
@@ -237,7 +237,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
                         * expand to WIM_CHUNK_SIZE uncompressed, and the amount
                         * of compressed data for the chunk is given by the
                         * difference of offsets in the chunk offset table. */
-                       compressed_chunk_size = chunk_offsets[i + 1 - start_chunk] - 
+                       compressed_chunk_size = chunk_offsets[i + 1 - start_chunk] -
                                                chunk_offsets[i - start_chunk];
                        uncompressed_chunk_size = WIM_CHUNK_SIZE;
                } else {
@@ -245,15 +245,15 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
                         * bytes in the file resource, and the last uncompressed
                         * chunk has size equal to however many bytes are left-
                         * that is, the remainder of the uncompressed size when
-                        * divided by WIM_CHUNK_SIZE. 
+                        * divided by WIM_CHUNK_SIZE.
                         *
                         * Note that the resource_compressed_size includes the
                         * chunk table, so the size of it must be subtracted. */
-                       compressed_chunk_size = resource_compressed_size - 
+                       compressed_chunk_size = resource_compressed_size -
                                                chunk_table_size -
                                                chunk_offsets[i - start_chunk];
 
-                       uncompressed_chunk_size = resource_uncompressed_size % 
+                       uncompressed_chunk_size = resource_uncompressed_size %
                                                                WIM_CHUNK_SIZE;
 
                        /* If the remainder is 0, the last chunk actually
@@ -280,7 +280,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
                        end_offset = WIM_CHUNK_SIZE - 1;
 
                u64 partial_chunk_size = end_offset + 1 - start_offset;
-               bool is_partial_chunk = (partial_chunk_size != 
+               bool is_partial_chunk = (partial_chunk_size !=
                                                uncompressed_chunk_size);
 
                DEBUG2("start_offset = %u, end_offset = %u", start_offset,
@@ -300,7 +300,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
                                        return WIMLIB_ERR_READ;
                                }
                        }
-                       if (fread(out_p, 1, partial_chunk_size, fp) != 
+                       if (fread(out_p, 1, partial_chunk_size, fp) !=
                                        partial_chunk_size)
                                goto err;
                } else {
@@ -308,7 +308,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
                        int ret;
 
                        /* Read the compressed data into compressed_buf. */
-                       if (fread(compressed_buf, 1, compressed_chunk_size, 
+                       if (fread(compressed_buf, 1, compressed_chunk_size,
                                                fp) != compressed_chunk_size)
                                goto err;
 
@@ -319,7 +319,7 @@ static int read_compressed_resource(FILE *fp, u64 resource_compressed_size,
 
                                ret = decompress(compressed_buf,
                                                compressed_chunk_size,
-                                               uncompressed_buf, 
+                                               uncompressed_buf,
                                                uncompressed_chunk_size);
                                if (ret != 0)
                                        return WIMLIB_ERR_DECOMPRESSION;
@@ -350,7 +350,7 @@ err:
        return WIMLIB_ERR_READ;
 }
 
-/* 
+/*
  * Reads uncompressed data from an open file stream.
  */
 int read_uncompressed_resource(FILE *fp, u64 offset, u64 len,
@@ -526,7 +526,7 @@ int read_wim_resource(const struct lookup_table_entry *lte, u8 buf[],
        }
 }
 
-/* 
+/*
  * Reads all the data from the resource corresponding to a WIM lookup table
  * entry.
  *
@@ -555,7 +555,7 @@ struct chunk_table {
        u64 offsets[0];
 };
 
-/* 
+/*
  * Allocates and initializes a chunk table, and reserves space for it in the
  * output file.
  */
@@ -601,7 +601,7 @@ out:
        return ret;
 }
 
-/* 
+/*
  * Compresses a chunk of a WIM resource.
  *
  * @chunk:             Uncompressed data of the chunk.
@@ -645,7 +645,7 @@ static int compress_chunk(const u8 chunk[], unsigned chunk_size,
  * @chunk:       Uncompressed data of the chunk.
  * @chunk_size:          Size of the chunk (<= WIM_CHUNK_SIZE)
  * @out_fp:      FILE * to write tho chunk to.
- * @out_ctype:   Compression type to use when writing the chunk (ignored if no 
+ * @out_ctype:   Compression type to use when writing the chunk (ignored if no
  *                     chunk table provided)
  * @chunk_tab:   Pointer to chunk table being created.  It is updated with the
  *                     offset of the chunk we write.
@@ -679,7 +679,7 @@ static int write_wim_resource_chunk(const u8 chunk[], unsigned chunk_size,
                *chunk_tab->cur_offset_p++ = chunk_tab->cur_offset;
                chunk_tab->cur_offset += out_chunk_size;
        }
-       
+
        if (fwrite(out_chunk, 1, out_chunk_size, out_fp) != out_chunk_size) {
                ERROR_WITH_ERRNO("Failed to write WIM resource chunk");
                return WIMLIB_ERR_WRITE;
@@ -687,7 +687,7 @@ static int write_wim_resource_chunk(const u8 chunk[], unsigned chunk_size,
        return 0;
 }
 
-/* 
+/*
  * Finishes a WIM chunk tale and writes it to the output file at the correct
  * offset.
  *
@@ -743,7 +743,7 @@ finish_wim_resource_chunk_tab(struct chunk_table *chunk_tab,
  *                     the same as the compression type of the WIM resource we
  *                     need to read, we simply copy the data (i.e. we do not
  *                     uncompress it, then compress it again).
- * @out_res_entry:  If non-NULL, a resource entry that is filled in with the 
+ * @out_res_entry:  If non-NULL, a resource entry that is filled in with the
  *                 offset, original size, compressed size, and compression flag
  *                 of the output resource.
  *
@@ -781,7 +781,7 @@ static int write_wim_resource(struct lookup_table_entry *lte,
                                 "stream");
                return WIMLIB_ERR_WRITE;
        }
-       
+
        /* Are the compression types the same?  If so, do a raw copy (copy
         * without decompressing and recompressing the data). */
        raw = (wim_resource_compression_type(lte) == out_ctype
@@ -876,7 +876,7 @@ static int write_wim_resource(struct lookup_table_entry *lte,
 
        /* Raw copy:  The new compressed size is the same as the old compressed
         * size
-        * 
+        *
         * Using WIM_COMPRESSION_TYPE_NONE:  The new compressed size is the
         * original size
         *
@@ -1002,10 +1002,10 @@ static int write_wim_resource_from_buffer(const u8 *buf, u64 buf_size,
        return 0;
 }
 
-/* 
+/*
  * Extracts the first @size bytes of the WIM resource specified by @lte to the
  * open file descriptor @fd.
- * 
+ *
  * Returns 0 on success; nonzero on failure.
  */
 int extract_wim_resource_to_fd(const struct lookup_table_entry *lte, int fd,
@@ -1044,9 +1044,9 @@ int extract_wim_resource_to_fd(const struct lookup_table_entry *lte, int fd,
        return 0;
 }
 
-/* 
+/*
  * Extracts the WIM resource specified by @lte to the open file descriptor @fd.
- * 
+ *
  * Returns 0 on success; nonzero on failure.
  */
 int extract_full_wim_resource_to_fd(const struct lookup_table_entry *lte, int fd)
@@ -1054,7 +1054,7 @@ int extract_full_wim_resource_to_fd(const struct lookup_table_entry *lte, int fd
        return extract_wim_resource_to_fd(lte, fd, wim_resource_size(lte));
 }
 
-/* 
+/*
  * Copies the file resource specified by the lookup table entry @lte from the
  * input WIM to the output WIM that has its FILE * given by
  * ((WIMStruct*)wim)->out_fp.
@@ -1075,7 +1075,7 @@ int copy_resource(struct lookup_table_entry *lte, void *wim)
                return 0;
 
        ret = write_wim_resource(lte, w->out_fp,
-                                wim_resource_compression_type(lte), 
+                                wim_resource_compression_type(lte),
                                 &lte->output_resource_entry);
        if (ret != 0)
                return ret;
@@ -1084,14 +1084,14 @@ int copy_resource(struct lookup_table_entry *lte, void *wim)
        return 0;
 }
 
-/* 
+/*
  * Writes a dentry's resources, including the main file resource as well as all
- * alternate data streams, to the output file. 
+ * alternate data streams, to the output file.
  *
  * @dentry:  The dentry for the file.
  * @wim_p:   A pointer to the WIMStruct containing @dentry.
  *
- * @return zero on success, nonzero on failure. 
+ * @return zero on success, nonzero on failure.
  */
 int write_dentry_resources(struct dentry *dentry, void *wim_p)
 {
@@ -1117,7 +1117,7 @@ int write_dentry_resources(struct dentry *dentry, void *wim_p)
        return ret;
 }
 
-/* 
+/*
  * Reads the metadata metadata resource from the WIM file.  The metadata
  * resource consists of the security data, followed by the directory entry for
  * the root directory, followed by all the other directory entries in the
@@ -1208,7 +1208,7 @@ int read_metadata_resource(WIMStruct *w, struct image_metadata *imd)
                ret = WIMLIB_ERR_NOMEM;
                goto out_free_security_data;
        }
-               
+
        ret = read_dentry(buf, metadata_len, dentry_offset, dentry);
 
        /* This is the root dentry, so set its pointers correctly. */
@@ -1319,7 +1319,7 @@ int write_metadata_resource(WIMStruct *w)
        DEBUG("Writing dentry tree.");
        p = write_dentry_tree(root, p);
 
-       /* 
+       /*
         * Append 20 random bytes to the metadata resource so that we don't have
         * identical metadata resources if we happen to append exactly the same
         * image twice without any changes in timestamps.  If this were to
index c05dd06f11168ce21a49e0dd721736f7eb75a0b4..55a603d6eddfe0221276d508d5cb2dddf52c647b 100644 (file)
@@ -29,7 +29,7 @@
 #include "io.h"
 #include "security.h"
 
-/* 
+/*
  * This is a hack to work around a problem in libntfs-3g.  libntfs-3g validates
  * security descriptors with a function named ntfs_valid_descr().
  * ntfs_valid_descr() considers a security descriptor that ends in a SACL
@@ -52,7 +52,7 @@ static void empty_sacl_fixup(char *descr, u64 *size_p)
        }
 }
 
-/* 
+/*
  * Reads the security data from the metadata resource.
  *
  * @metadata_resource: An array that contains the uncompressed metadata
@@ -185,7 +185,7 @@ out_free_sd:
        return ret;
 }
 
-/* 
+/*
  * Writes security data to an in-memory buffer.
  */
 u8 *write_security_data(const struct wim_security_data *sd, u8 *p)
@@ -280,7 +280,7 @@ static void print_security_descriptor(const u8 *p, u64 size)
                print_acl(p + dacl_offset, "Discretionary");
 }
 
-/* 
+/*
  * Prints the security data for a WIM file.
  */
 void print_security_data(const struct wim_security_data *sd)
@@ -292,7 +292,7 @@ void print_security_data(const struct wim_security_data *sd)
        printf("Number of Entries = %"PRIu32"\n", sd->num_entries);
 
        for (u32 i = 0; i < sd->num_entries; i++) {
-               printf("[SecurityDescriptor %"PRIu32", length = %"PRIu64"]\n", 
+               printf("[SecurityDescriptor %"PRIu32", length = %"PRIu64"]\n",
                       i, sd->sizes[i]);
                print_security_descriptor(sd->descriptors[i], sd->sizes[i]);
                putchar('\n');
index 77e72d65a1de9c36fd60dc49cea8a189cd1da619..490a7c337ebd21ac1e10d760eb4f512175f6edfb 100644 (file)
@@ -135,7 +135,7 @@ enum ace_type {
 /* At the start of each type of access control entry.  */
 typedef struct {
        /* enum ace_type, specifies what type of ACE this is.  */
-       u8 type; 
+       u8 type;
 
        /* bitwise OR of the inherit ACE flags #defined above */
        u8 flags;
index ce3d9b6d155ee911018242a9b6f9e73b88f302e9..05c4ab890bd31baca310a4171abf95f6db19938e 100644 (file)
@@ -4,7 +4,7 @@
  * Parts of this file are based on public domain code written by Steve Reid.
  */
 
-/* 
+/*
  * Copyright (C) 2012 Eric Biggers
  *
  * This file is part of wimlib, a library for working with WIM files.
@@ -69,7 +69,7 @@ void sha1_update(SHA_CTX *context, const u8 data[], size_t len)
 #include <stdlib.h>
 void ssse3_not_found()
 {
-       fprintf(stderr, 
+       fprintf(stderr,
 "Cannot calculate SHA1 message digest: CPU does not support SSSE3\n"
 "instructions!  Recompile wimlib without the --enable-ssse3-sha1 flag\n"
 "to use wimlib on this CPU.\n");
index b8cb67896e57743eec0e768455260f9c76dbfcdd..2cb5a8e44c9575b35f2fa1d36fecc8f0c7daf1f2 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")", 
+       DEBUG("Writing lookup table for SWM (offset %"PRIu64")",
                        lookup_table_offset);
 
        while (lte_chain_head != NULL) {
@@ -65,7 +65,7 @@ static int finish_swm(WIMStruct *w, struct lookup_table_entry *lte_chain_head,
        if (lookup_table_offset == -1 || xml_data_offset == -1)
                return WIMLIB_ERR_WRITE;
        w->hdr.lookup_table_res_entry.offset = lookup_table_offset;
-       w->hdr.lookup_table_res_entry.size = 
+       w->hdr.lookup_table_res_entry.size =
                                xml_data_offset - lookup_table_offset;
        ret = finish_write(w, WIM_ALL_IMAGES, write_flags, 0);
        if (ret != 0)
@@ -88,7 +88,7 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args)
        if (lte->resource_entry.flags & WIM_RESHDR_FLAG_METADATA)
                return 0;
 
-       if (args->size_remaining < 0 || 
+       if (args->size_remaining < 0 ||
                        (u64)args->size_remaining < lte->resource_entry.size) {
 
                /* No space for this resource.  Finish the previous swm and
@@ -99,7 +99,7 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args)
                args->lte_chain_tail = NULL;
                args->lte_chain_head = NULL;
 
-               sprintf(args->swm_base_name + args->swm_base_name_len, "%d", 
+               sprintf(args->swm_base_name + args->swm_base_name_len, "%d",
                        ++args->part_number);
                strcat(args->swm_base_name, args->swm_suffix);
 
@@ -107,8 +107,8 @@ 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, 
+                              "%.0f%% done)\n",
+                              args->swm_base_name,
                               args->total_bytes_written,
                               args->total_bytes,
                               (double)args->total_bytes_written /
@@ -131,7 +131,7 @@ static int copy_resource_to_swm(struct lookup_table_entry *lte, void *__args)
 
 /* Splits the WIM file @wimfile into multiple parts prefixed by @swm_name with
  * size at most @part_size. */
-WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name, 
+WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name,
                           size_t part_size, int flags)
 {
        int ret;
@@ -177,8 +177,8 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name,
        }
 
        if (write_flags & WIMLIB_OPEN_FLAG_SHOW_PROGRESS)
-               printf("Writing `%s' (%.2f %% done)\n", 
-                       swm_name, 
+               printf("Writing `%s' (%.2f %% done)\n",
+                       swm_name,
                        (double)total_bytes_written /
                                (double)total_bytes * 100.0);
 
@@ -248,7 +248,7 @@ WIMLIBAPI int wimlib_split(const char *wimfile, const char *swm_name,
                put_u16(&buf[0], i);
                put_u16(&buf[2], total_parts);
 
-               if (fseek(fp, 40, SEEK_SET) != 0 || 
+               if (fseek(fp, 40, SEEK_SET) != 0 ||
                                fwrite(buf, 1, sizeof(buf), fp) != sizeof(buf)
                                || fclose(fp) != 0) {
                        ERROR_WITH_ERRNO("Error overwriting header of `%s'",
index 697da93e1f8d836a57b18fb82efdc0cfb6081aad..bed8fc3e06c7774934e54c1c05a42faebd6ed74e 100644 (file)
@@ -105,7 +105,7 @@ static ssize_t get_symlink_name(const u8 *resource, size_t resource_len,
                translated_target += 4;
                link_target_len -= 4;
                /* There's a drive letter, so just leave the backslashes since
-                * it won't go anyhwere on UNIX anyway... 
+                * it won't go anyhwere on UNIX anyway...
                 *
                 * XXX
                 * NTFS-3g tries to re-map these links to actually point to
@@ -185,7 +185,7 @@ ssize_t inode_readlink(const struct inode *inode, char *buf, size_t buf_len,
                                buf_len, inode->reparse_tag);
 }
 
-/* 
+/*
  * Sets @inode to be a symbolic link pointing to @target.
  *
  * A lookup table entry for the symbolic link data buffer is created and
@@ -206,14 +206,14 @@ int inode_set_symlink(struct inode *inode, const char *target,
        struct lookup_table_entry *lte = NULL, *existing_lte;
        u8 symlink_buf_hash[SHA1_HASH_SIZE];
        void *symlink_buf;
-       
+
        symlink_buf = make_symlink_reparse_data_buf(target, &symlink_buf_len);
        if (!symlink_buf)
                return WIMLIB_ERR_NOMEM;
 
        DEBUG("Made symlink reparse data buf (len = %zu, name len = %zu)",
                        symlink_buf_len, symlink_buf_len);
-       
+
        sha1_buffer(symlink_buf, symlink_buf_len, symlink_buf_hash);
 
        existing_lte = __lookup_resource(lookup_table, symlink_buf_hash);
index 911b7c5e2cc92e3897320e7d132dfd08abd8fdf8..4563d506be1c1c0e9e28a1dfd4038ea425b6604c 100644 (file)
@@ -61,9 +61,9 @@ typedef unsigned uint;
 
 #ifdef ENABLE_ERROR_MESSAGES
 extern bool __wimlib_print_errors;
-extern void wimlib_error(const char *format, ...) 
+extern void wimlib_error(const char *format, ...)
                FORMAT(printf, 1, 2) COLD;
-extern void wimlib_error_with_errno(const char *format, ...) 
+extern void wimlib_error_with_errno(const char *format, ...)
                FORMAT(printf, 1, 2) COLD;
 extern void wimlib_warning(const char *format, ...)
                FORMAT(printf, 1, 2) COLD;
@@ -131,14 +131,14 @@ extern char *wimlib_strdup(const char *str);
 extern char *utf16_to_utf8(const char *utf16_str, size_t utf16_len,
                           size_t *utf8_len_ret);
 
-extern char *utf8_to_utf16(const char *utf8_str, size_t utf8_len, 
+extern char *utf8_to_utf16(const char *utf8_str, size_t utf8_len,
                           size_t *utf16_len_ret);
 
 extern void randomize_byte_array(u8 *p, size_t n);
 
 extern void randomize_char_array_with_alnum(char p[], size_t n);
 
-extern const char *path_next_part(const char *path, 
+extern const char *path_next_part(const char *path,
                                  size_t *first_part_len_ret);
 
 extern const char *path_basename(const char *path);
index 5ed6c684c7245cc5b7b0ad3d35a0669efc72879d..dddfd2ad6a02674caeeec144e33904acf64991f2 100644 (file)
@@ -4,7 +4,7 @@
  * External header for wimlib.
  */
 
-/* 
+/*
  * Copyright (C) 2012 Eric Biggers
  *
  * This file is part of wimlib, a library for working with WIM files.
@@ -57,7 +57,7 @@
  * A WIM file may be either stand-alone or split into multiple parts.
  *
  * \section winpe Windows PE
- * 
+ *
  * A major use for this library is to create customized images of Windows PE, the
  * Windows Preinstallation Environment, without having to rely on Windows.  Windows
  * PE is a lightweight version of Windows that can run entirely from memory and can
  * wimlib comes with the <b>imagex</b> program, which is documented in man pages.
  *
  * \section mkwinpeimg mkwinpeimg
- * 
+ *
  * wimlib comes with the <b>mkwinpeimg</b> script, which is documented in a man
  * page.
  *
 #include <stdbool.h>
 
 #ifndef _WIMLIB_INTERNAL_H
-/** 
- * Opaque structure that represents a WIM file. 
+/**
+ * Opaque structure that represents a WIM file.
  */
 typedef struct WIMStruct WIMStruct;
 #endif
@@ -252,7 +252,7 @@ enum wim_compression_type {
  * alternate file stream name. */
 #define WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS     0x00000040
 
-/** Include an integrity table in the new WIM being written during the unmount. 
+/** Include an integrity table in the new WIM being written during the unmount.
  * Ignored for read-only mounts. */
 #define WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY    0x00000001
 
@@ -390,7 +390,7 @@ enum wimlib_error_code {
  * @param config_len
  *     Length of the string @a config in bytes.  Ignored if @a config is @c
  *     NULL.
- *     
+ *
  * @param flags
  *     Bitwise OR of flags prefixed with WIMLIB_ADD_IMAGE_FLAG.  If
  *     ::WIMLIB_ADD_IMAGE_FLAG_BOOT is specified, the image in @a wim that is
@@ -405,9 +405,9 @@ enum wimlib_error_code {
  * discarded so that it appears to be in the same state as when this function
  * was called.
  *
- * @retval ::WIMLIB_ERR_IMAGE_NAME_COLLISION 
+ * @retval ::WIMLIB_ERR_IMAGE_NAME_COLLISION
  *     There is already an image named @a name in @a w.
- * @retval ::WIMLIB_ERR_INVALID_PARAM 
+ * @retval ::WIMLIB_ERR_INVALID_PARAM
  *     @a dir was @c NULL, @a name was @c NULL, or @a name was the empty string.
  * @retval ::WIMLIB_ERR_NOMEM
  *     Failed to allocate needed memory.
@@ -428,7 +428,7 @@ enum wimlib_error_code {
  *     @a wim is part of a split WIM.  Adding an image to a split WIM is
  *     unsupported.
  */
-extern int wimlib_add_image(WIMStruct *wim, const char *dir, 
+extern int wimlib_add_image(WIMStruct *wim, const char *dir,
                            const char *name, const char *config,
                            size_t config_len, int flags);
 
@@ -459,10 +459,10 @@ extern int wimlib_apply_image_to_ntfs_volume(WIMStruct *wim, int image,
                                             WIMStruct **additional_swms,
                                             unsigned num_additional_swms);
 
-/** 
+/**
  * Creates a WIMStruct for a new WIM file.
  *
- * @param ctype 
+ * @param ctype
  *     The type of compression to be used in the new WIM file.  Must be
  *     ::WIM_COMPRESSION_TYPE_NONE, ::WIM_COMPRESSION_TYPE_LZX, or
  *     ::WIM_COMPRESSION_TYPE_XPRESS.
@@ -507,9 +507,9 @@ extern int wimlib_create_new_wim(int ctype, WIMStruct **wim_ret);
  * @retval ::WIMLIB_ERR_INVALID_IMAGE
  *     @a image does not exist in the WIM and is not ::WIM_ALL_IMAGES.
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
- *     The metadata resource for @a image in the WIM is invalid.       
+ *     The metadata resource for @a image in the WIM is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
- *     The security data for @a image in the WIM is invalid.   
+ *     The security data for @a image in the WIM is invalid.
  * @retval ::WIMLIB_ERR_NOMEM
  *     Failed to allocate needed memory.
  * @retval ::WIMLIB_ERR_READ
@@ -590,7 +590,7 @@ extern int wimlib_delete_image(WIMStruct *wim, int image);
  * @retval ::WIMLIB_ERR_IMAGE_NAME_COLLISION
  *     One or more of the names being given to an exported image was already in
  *     use in the destination WIM.
- * @retval ::WIMLIB_ERR_INVALID_DENTRY 
+ * @retval ::WIMLIB_ERR_INVALID_DENTRY
  *     A directory entry in the metadata resource for @a src_image in @a
  *     src_wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_IMAGE
@@ -603,10 +603,10 @@ extern int wimlib_delete_image(WIMStruct *wim, int image);
  *     ::WIM_ALL_IMAGES, and @a src_wim contains multiple images; or @a src_wim
  *     or @a dest_wim was @c NULL.
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
- *     The metadata resource for @a src_image in @a src_wim is invalid.        
+ *     The metadata resource for @a src_image in @a src_wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
- *     The security data for @a src_image in @a src_wim is invalid.    
- * @retval ::WIMLIB_ERR_NOMEM 
+ *     The security data for @a src_image in @a src_wim is invalid.
+ * @retval ::WIMLIB_ERR_NOMEM
  *     Failed to allocate needed memory.
  * @retval ::WIMLIB_ERR_READ
  *     Could not read the metadata resource for @a src_image from @a src_wim.
@@ -619,8 +619,8 @@ extern int wimlib_delete_image(WIMStruct *wim, int image);
  *     @a dest_wim is part of a split WIM.  Exporting an image to a split WIM
  *     is unsupported.
  */
-extern int wimlib_export_image(WIMStruct *src_wim, int src_image, 
-                              WIMStruct *dest_wim, const char *dest_name, 
+extern int wimlib_export_image(WIMStruct *src_wim, int src_image,
+                              WIMStruct *dest_wim, const char *dest_name,
                               const char *dest_description, int flags,
                               WIMStruct **additional_swms,
                               unsigned num_additional_swms);
@@ -667,16 +667,16 @@ extern int wimlib_export_image(WIMStruct *src_wim, int src_image,
  * @retval ::WIMLIB_ERR_DECOMPRESSION
  *     Could not decompress a resource (file or metadata) for @a image in @a
  *     wim.
- * @retval ::WIMLIB_ERR_INVALID_DENTRY 
+ * @retval ::WIMLIB_ERR_INVALID_DENTRY
  *     A directory entry in the metadata resource for @a image in @a wim is
  *     invalid.
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_HASH
  *     The SHA1 message digest of an extracted stream did not match the SHA1
  *     message digest given in the WIM file.
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
- *     A resource (file or metadata) for @a image in @a wim is invalid.        
+ *     A resource (file or metadata) for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
- *     The security data for @a image in @a wim is invalid.    
+ *     The security data for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_LINK
  *     Failed to create a symbolic link or a hard link.
  * @retval ::WIMLIB_ERR_MKDIR
@@ -708,8 +708,8 @@ extern int wimlib_extract_image(WIMStruct *wim, int image,
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * @param fp 
- *     @c stdout, or a FILE* opened for writing, to extract the data to.  
+ * @param fp
+ *     @c stdout, or a FILE* opened for writing, to extract the data to.
  *
  * @return 0 on success; nonzero on error.
  * @retval ::WIMLIB_ERR_WRITE
@@ -719,7 +719,7 @@ extern int wimlib_extract_xml_data(WIMStruct *wim, FILE *fp);
 
 /**
  * Frees all memory allocated for a WIMStruct and closes all files associated
- * with it. 
+ * with it.
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
@@ -733,7 +733,7 @@ extern void wimlib_free(WIMStruct *wim);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * 
+ *
  * @return
  *     0 if no image is marked as bootable, or the number of the image marked
  *     as bootable (numbered starting at 1).
@@ -745,7 +745,7 @@ extern int wimlib_get_boot_idx(const WIMStruct *wim);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file
- * 
+ *
  * @return
  *     ::WIM_COMPRESSION_TYPE_NONE, ::WIM_COMPRESSION_TYPE_LZX, or
  *     ::WIM_COMPRESSION_TYPE_XPRESS.
@@ -819,7 +819,7 @@ extern const char *wimlib_get_image_name(const WIMStruct *wim, int image);
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.  It may be either a
  *     standalone WIM or a split WIM part.
- * 
+ *
  * @return
  *     The number of images contained in the WIM file.
  */
@@ -834,7 +834,7 @@ extern int wimlib_get_num_images(const WIMStruct *wim);
  *     If non-@c NULL, the total number of parts in the split WIM (1 for
  *     non-split WIMs) is written to this location.
  *
- * @return 
+ * @return
  *     The part number of the WIM (1 for non-split WIMs)
  */
 extern int wimlib_get_part_number(const WIMStruct *wim, int *total_parts_ret);
@@ -942,7 +942,7 @@ extern int wimlib_join(const char **swms, unsigned num_swms,
  *     Could not decompress the metadata resource for @a image in @a wim.
  * @retval ::WIMLIB_ERR_FUSE
  *     A non-zero status was returned by @c fuse_main().
- * @retval ::WIMLIB_ERR_INVALID_DENTRY 
+ * @retval ::WIMLIB_ERR_INVALID_DENTRY
  *     A directory entry in the metadata resource for @a image in @a wim is
  *     invalid.
  * @retval ::WIMLIB_ERR_INVALID_IMAGE
@@ -951,9 +951,9 @@ extern int wimlib_join(const char **swms, unsigned num_swms,
  *     @a image is shared among multiple ::WIMStruct's as a result of a call to
  *     wimlib_export().
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
- *     The metadata resource for @a image in @a wim is invalid.        
+ *     The metadata resource for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
- *     The security data for @a image in @a wim is invalid.    
+ *     The security data for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_MKDIR
  *     ::WIMLIB_MOUNT_FLAG_READWRITE was specified in @a flags, but the staging
  *     directory could not be created.
@@ -980,7 +980,7 @@ extern int wimlib_mount(WIMStruct *wim, int image, const char *dir, int flags,
 /**
  * Opens a WIM file and creates a ::WIMStruct for it.
  *
- * @param wim_file 
+ * @param wim_file
  *     The path to the WIM file to open.
  * @param flags
  *     Bitwise OR of ::WIMLIB_OPEN_FLAG_CHECK_INTEGRITY and/or
@@ -1050,7 +1050,7 @@ extern int wimlib_mount(WIMStruct *wim, int image, const char *dir, int flags,
  * @retval ::WIMLIB_ERR_XML
  *     The XML data for @a wim_file is invalid.
  */
-extern int wimlib_open_wim(const char *wim_file, int flags, 
+extern int wimlib_open_wim(const char *wim_file, int flags,
                           WIMStruct **wim_ret);
 
 /**
@@ -1067,7 +1067,7 @@ extern int wimlib_open_wim(const char *wim_file, int flags,
  *     Pointer to the ::WIMStruct for the WIM file to write.  There may have
  *     been in-memory changes made to it, which are then reflected in the
  *     output file.
- * @param flags 
+ * @param flags
  *     Bitwise OR of ::WIMLIB_WRITE_FLAG_CHECK_INTEGRITY and/or
  *     ::WIMLIB_WRITE_FLAG_SHOW_PROGRESS.
  *
@@ -1095,7 +1095,7 @@ extern int wimlib_overwrite(WIMStruct *wim, int flags);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for the WIM file to overwrite.
- * @param flags 
+ * @param flags
  *     Bitwise OR of ::WIMLIB_WRITE_FLAG_CHECK_INTEGRITY and/or
  *     ::WIMLIB_WRITE_FLAG_SHOW_PROGRESS.
  *
@@ -1124,11 +1124,11 @@ extern int wimlib_overwrite_xml_and_header(WIMStruct *wim, int flags);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * @param image 
+ * @param image
  *     The image about which to print information.  Can be the number of an
  *     image, or ::WIM_ALL_IMAGES to print information about all images in the
  *     WIM.
- * 
+ *
  * @return This function has no return value.  No error checking is done when
  * printing the information.  If @a image is invalid, an error message is
  * printed.
@@ -1141,9 +1141,9 @@ extern void wimlib_print_available_images(const WIMStruct *wim, int image);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * @param image 
+ * @param image
  *     Which image to print files for.  Can be the number of an image, or
- *     ::WIM_ALL_IMAGES to print the files contained in all images.  
+ *     ::WIM_ALL_IMAGES to print the files contained in all images.
  *
  * @return 0 on success; nonzero on error.
  * @retval ::WIMLIB_ERR_DECOMPRESSION
@@ -1184,7 +1184,7 @@ extern int wimlib_print_files(WIMStruct *wim, int image);
  */
 extern void wimlib_print_header(const WIMStruct *wim);
 
-/** 
+/**
  * Prints the lookup table of a WIM file.  The lookup table maps SHA1 message
  * digests, as found in the directory entry tree in the WIM file, to file
  * resources in the WIM file.  This table includes one entry for each unique
@@ -1201,11 +1201,11 @@ extern void wimlib_print_lookup_table(WIMStruct *wim);
 /**
  * Prints the metadata of the specified image in a WIM file.  The metadata
  * consists of the security data as well as the directory entry tree, and each
- * image has its own metadata.  
+ * image has its own metadata.
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * @param image 
+ * @param image
  *     Which image to print the metadata for.  Can be the number of an image,
  *     or ::WIM_ALL_IMAGES to print the metadata for all images in the WIM.
  *
@@ -1245,7 +1245,7 @@ extern int wimlib_print_metadata(WIMStruct *wim, int image);
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
  *
- * @return This function has no return value.  
+ * @return This function has no return value.
  */
 extern void wimlib_print_wim_information(const WIMStruct *wim);
 
@@ -1255,14 +1255,14 @@ extern void wimlib_print_wim_information(const WIMStruct *wim);
  *
  * @param wim
  *     Pointer to the ::WIMStruct for a WIM file.
- * @param image_name_or_num  
+ * @param image_name_or_num
  *     A string specifying which image.  If it begins with a number, it is
  *     taken to be a string specifying the image number.  Otherwise, it is
  *     taken to be the name of an image, as specified in the XML data for the
  *     WIM file.  It also may be the keyword "all" or the string "*", both of
  *     which will resolve to ::WIM_ALL_IMAGES.
  *
- * @return 
+ * @return
  *     If the string resolved to a single existing image, the number of that
  *     image, counting starting at 1, is returned.  If the keyword "all" was
  *     specified, ::WIM_ALL_IMAGES is returned.  Otherwise, ::WIM_NO_IMAGE is
@@ -1281,7 +1281,7 @@ extern int wimlib_resolve_image(WIMStruct *wim, const char *image_name_or_num);
  * @return 0 on success; nonzero on error.
  * @retval ::WIMLIB_ERR_INVALID_PARAM
  *     @a wim was @c NULL.
- * @retval ::WIMLIB_ERR_INVALID_IMAGE 
+ * @retval ::WIMLIB_ERR_INVALID_IMAGE
  *     @a boot_idx does not specify an existing image in @a wim, and it was not
  *     0.
  * @retval ::WIMLIB_ERR_SPLIT_UNSUPPORTED
@@ -1312,7 +1312,7 @@ extern int wimlib_set_boot_idx(WIMStruct *wim, int boot_idx);
  *     Failed to allocate the memory needed to duplicate the @a description
  *     string.
  */
-extern int wimlib_set_image_descripton(WIMStruct *wim, int image, 
+extern int wimlib_set_image_descripton(WIMStruct *wim, int image,
                                       const char *description);
 
 /**
@@ -1442,7 +1442,7 @@ extern int wimlib_set_print_errors(bool show_messages);
  *     An error occurred when trying to write data to one of the split WIMs.
  *
  */
-extern int wimlib_split(const char *wimfile, const char *swm_name, 
+extern int wimlib_split(const char *wimfile, const char *swm_name,
                        size_t part_size, int flags);
 
 /**
@@ -1459,7 +1459,7 @@ extern int wimlib_split(const char *wimfile, const char *swm_name,
  * there should be no infinite loops or crashes in the code, so this wouldn't be
  * much of a problem.  Currently, a timeout of 600 seconds (so long because WIMs
  * can be very large) is implemented so that this function will not wait forever
- * before returning failure.  
+ * before returning failure.
  *
  * @param dir
  *     The directory that the WIM image was mounted on.
@@ -1515,7 +1515,7 @@ extern int wimlib_unmount(const char *dir, int flags);
  * @param image
  *     The image inside the WIM to write.  Use ::WIM_ALL_IMAGES to include all
  *     images.
- * @param flags 
+ * @param flags
  *     Bitwise OR of ::WIMLIB_WRITE_FLAG_CHECK_INTEGRITY and/or
  *     ::WIMLIB_WRITE_FLAG_SHOW_PROGRESS.  If
  *     ::WIMLIB_WRITE_FLAG_CHECK_INTEGRITY is given, an integrity table is
@@ -1526,7 +1526,7 @@ extern int wimlib_unmount(const char *dir, int flags);
  * @return 0 on success; nonzero on error.
  * @retval ::WIMLIB_ERR_DECOMPRESSION
  *     Failed to decompress a metadata or file resource in @a wim.
- * @retval ::WIMLIB_ERR_INVALID_DENTRY 
+ * @retval ::WIMLIB_ERR_INVALID_DENTRY
  *     A directory entry in the metadata resource for @a image in @a wim is
  *     invalid.
  * @retval ::WIMLIB_ERR_INVALID_IMAGE
@@ -1539,7 +1539,7 @@ extern int wimlib_unmount(const char *dir, int flags);
  * @retval ::WIMLIB_ERR_INVALID_PARAM
  *     @a wim or @a path was @c NULL.
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
- *     The metadata resource for @a image in @a wim is invalid.        
+ *     The metadata resource for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
  *     The security data for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_NOMEM
index d9a00220b28d57b0b301a600c0baf81327cae606..08d764d152a70eaa9909d37c3eb9059564d3c12d 100644 (file)
@@ -95,10 +95,10 @@ struct resource_entry {
 
 
 /* Header at the very beginning of the WIM file. */
-struct wim_header { 
+struct wim_header {
        /* Identifies the file as WIM file. Must be exactly
         * {'M', 'S', 'W', 'I', 'M', 0, 0, 0}  */
-       //u8  magic[WIM_MAGIC_LEN];     
+       //u8  magic[WIM_MAGIC_LEN];
 
        /* size of WIM header in bytes. */
        //u32 hdr_size;
@@ -116,7 +116,7 @@ struct wim_header {
         * WIM_CHUNK_SIZE.  M$ incorrectly documents this as "the size of the
         * compressed .wim file in bytes".*/
        //u32 chunk_size;
-       
+
        /* A unique identifier for the WIM file. */
        u8  guid[WIM_GID_LEN];
 
@@ -142,7 +142,7 @@ struct wim_header {
 
        /* The index of the bootable image in the WIM file. If 0, there are no
         * bootable images available. */
-       u32 boot_idx; 
+       u32 boot_idx;
 
        /* The location of the optional integrity table used to verify the
         * integrity WIM.  Zeroed out if there is no integrity table.*/
@@ -177,7 +177,7 @@ struct wim_header {
 
 /* Lock field to prevent multiple writers from writing the WIM concurrently.  We
  * ignore this flag. */
-#define WIM_HDR_FLAG_WRITE_IN_PROGRESS  0x00000040 
+#define WIM_HDR_FLAG_WRITE_IN_PROGRESS  0x00000040
 
 /* Reparse point fixup ???
  * This has something to do with absolute targets of reparse points / symbolic
@@ -207,7 +207,7 @@ struct wim_security_data {
         * that wimlib writes, currently), it will be 8 bytes. */
        u32 total_length;
 
-       /* The number of security descriptors in the array @descriptors, below.  
+       /* The number of security descriptors in the array @descriptors, below.
         * It is really an unsigned int, but it must fit into an int because the
         * security ID's are signed.  (Not like you would ever have more than a
         * few hundred security descriptors anyway). */
@@ -260,7 +260,7 @@ typedef struct WIMStruct {
        /* The name of the WIM file that has been opened. */
        char  *filename;
 
-       /* The lookup table for the WIM file. */ 
+       /* The lookup table for the WIM file. */
        struct lookup_table *lookup_table;
 
        /* Pointer to the XML data read from the WIM file. */
@@ -358,7 +358,7 @@ struct inode_table {
        u64 num_entries;
        u64 capacity;
 
-       /* 
+       /*
         * Linked list of "extra" inodes.  These may be:
         *
         * - inodes with link count 1, which are all allowed to have 0 for their
@@ -388,7 +388,7 @@ extern int write_header(const struct wim_header *hdr, FILE *out);
 extern int init_header(struct wim_header *hdr, int ctype);
 
 /* integrity.c */
-extern int write_integrity_table(FILE *out, u64 end_header_offset, 
+extern int write_integrity_table(FILE *out, u64 end_header_offset,
                                 u64 end_lookup_table_offset,
                                 int show_progress);
 extern int check_wim_integrity(WIMStruct *w, int show_progress, int *status);
@@ -413,8 +413,8 @@ extern int do_add_image(WIMStruct *w, const char *dir, const char *name,
                        const char *config_str, size_t config_len,
                        int flags,
                        int (*capture_tree)(struct dentry **, const char *,
-                                    struct lookup_table *, 
-                                    struct wim_security_data *, 
+                                    struct lookup_table *,
+                                    struct wim_security_data *,
                                     const struct capture_config *,
                                     int, void *),
                        void *extra_arg);
@@ -447,7 +447,7 @@ extern int write_metadata_resource(WIMStruct *w);
 
 
 /* security.c */
-int read_security_data(const u8 metadata_resource[], 
+int read_security_data(const u8 metadata_resource[],
                u64 metadata_resource_len, struct wim_security_data **sd_p);
 
 void print_security_data(const struct wim_security_data *sd);
@@ -471,7 +471,7 @@ extern int wim_hdr_flags_compression_type(int wim_hdr_flags);
 extern int for_image(WIMStruct *w, int image, int (*visitor)(WIMStruct *));
 
 /* write.c */
-extern int finish_write(WIMStruct *w, int image, int flags, 
+extern int finish_write(WIMStruct *w, int image, int flags,
                        int write_lookup_table);
 
 extern int begin_write(WIMStruct *w, const char *path, int flags);
index 7f92366d2e57bf6a63d2d46b39940729eb112a60..124e1bbc1e622d1371f410ec8134f01cbf6e1806 100644 (file)
@@ -51,7 +51,7 @@ static int reopen_rw(WIMStruct *w)
 
 
 
-/* 
+/*
  * Writes a WIM file to the original file that it was read from, overwriting it.
  */
 WIMLIBAPI int wimlib_overwrite(WIMStruct *w, int flags)
@@ -59,7 +59,7 @@ WIMLIBAPI int wimlib_overwrite(WIMStruct *w, int flags)
        const char *wimfile_name;
        size_t wim_name_len;
        int ret;
-       
+
        if (!w)
                return WIMLIB_ERR_INVALID_PARAM;
 
@@ -133,7 +133,7 @@ WIMLIBAPI int wimlib_overwrite_xml_and_header(WIMStruct *w, int flags)
         * the integrity table include neither the header nor the XML data.
         * Save it for later if it exists and an integrity table was required.
         * */
-       if (flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY && 
+       if (flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY &&
                        w->hdr.integrity.offset != 0) {
                DEBUG("Reading existing integrity table.");
                integrity_table = MALLOC(w->hdr.integrity.size);
@@ -176,7 +176,7 @@ WIMLIBAPI int wimlib_overwrite_xml_and_header(WIMStruct *w, int flags)
                w->hdr.integrity.offset        = xml_end;
                if (integrity_table) {
                        /* The existing integrity table was saved. */
-                       bytes_written = fwrite(integrity_table, 1, 
+                       bytes_written = fwrite(integrity_table, 1,
                                               w->hdr.integrity.size, fp);
                        if (bytes_written != w->hdr.integrity.size) {
                                ERROR_WITH_ERRNO("Failed to write integrity "
@@ -189,7 +189,7 @@ WIMLIBAPI int wimlib_overwrite_xml_and_header(WIMStruct *w, int flags)
                        /* There was no existing integrity table, so a new one
                         * must be calculated. */
                        ret = write_integrity_table(fp, WIM_HEADER_DISK_SIZE,
-                                       w->hdr.lookup_table_res_entry.offset + 
+                                       w->hdr.lookup_table_res_entry.offset +
                                        w->hdr.lookup_table_res_entry.size,
                                        flags & WIMLIB_WRITE_FLAG_SHOW_PROGRESS);
                        if (ret != 0)
@@ -301,7 +301,7 @@ int finish_write(WIMStruct *w, int image, int flags, int write_lt)
        hdr.lookup_table_res_entry.original_size = hdr.lookup_table_res_entry.size;
        hdr.lookup_table_res_entry.flags         = WIM_RESHDR_FLAG_METADATA;
 
-       ret = write_xml_data(w->wim_info, image, out, 
+       ret = write_xml_data(w->wim_info, image, out,
                             write_lt ? 0 : wim_info_get_total_bytes(w->wim_info));
        if (ret != 0)
                return ret;
@@ -317,8 +317,8 @@ int finish_write(WIMStruct *w, int image, int flags, int write_lt)
        hdr.xml_res_entry.flags                  = 0;
 
        if (flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY) {
-               ret = write_integrity_table(out, WIM_HEADER_DISK_SIZE, 
-                                           xml_data_offset, 
+               ret = write_integrity_table(out, WIM_HEADER_DISK_SIZE,
+                                           xml_data_offset,
                                            flags & WIMLIB_WRITE_FLAG_SHOW_PROGRESS);
                if (ret != 0)
                        return ret;
@@ -338,7 +338,7 @@ int finish_write(WIMStruct *w, int image, int flags, int write_lt)
 
        DEBUG("Updating WIM header.");
 
-       /* 
+       /*
         * In the WIM header, there is room for the resource entry for a
         * metadata resource labeled as the "boot metadata".  This entry should
         * be zeroed out if there is no bootable image (boot_idx 0).  Otherwise,
@@ -347,10 +347,10 @@ int finish_write(WIMStruct *w, int image, int flags, int write_lt)
         */
        if (hdr.boot_idx == 0 || !w->image_metadata
                        || (image != WIM_ALL_IMAGES && image != hdr.boot_idx)) {
-               memset(&hdr.boot_metadata_res_entry, 0, 
+               memset(&hdr.boot_metadata_res_entry, 0,
                       sizeof(struct resource_entry));
        } else {
-               memcpy(&hdr.boot_metadata_res_entry, 
+               memcpy(&hdr.boot_metadata_res_entry,
                       &w->image_metadata[
                          hdr.boot_idx - 1].metadata_lte->output_resource_entry,
                       sizeof(struct resource_entry));
@@ -379,10 +379,10 @@ int begin_write(WIMStruct *w, const char *path, int flags)
        DEBUG("Opening `%s' for new WIM", path);
 
        /* checking the integrity requires going back over the file to read it.
-        * XXX 
+        * XXX
         * (It also would be possible to keep a running sha1sum as the file
         * as written-- this would be faster, but a bit more complicated) */
-       if (flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY) 
+       if (flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY)
                mode = "w+b";
        else
                mode = "wb";
@@ -406,7 +406,7 @@ WIMLIBAPI int wimlib_write(WIMStruct *w, const char *path, int image, int flags)
        if (!w || !path)
                return WIMLIB_ERR_INVALID_PARAM;
 
-       if (image != WIM_ALL_IMAGES && 
+       if (image != WIM_ALL_IMAGES &&
             (image < 1 || image > w->hdr.image_count))
                return WIMLIB_ERR_INVALID_IMAGE;
 
index 89d08e0e4eec1200334772fcd0a3dd888f970feb..922886d1afa001383e4790eb15465477a1cfe99e 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1083,7 +1083,7 @@ void xml_update_image_info(WIMStruct *w, int image)
        for_dentry_in_tree(w->image_metadata[image - 1].root_dentry,
                           calculate_dentry_statistics,
                           image_info);
-                        
+
        image_info->lookup_table = NULL;
        image_info->flags = flags_save;
        image_info->last_modification_time = get_wim_timestamp();
index 701a93a34fd01187e4d66dbd2200b54203fb2d00..f9999e905e8403e35259c5a3721de4b21d7eb313 100644 (file)
--- a/src/xml.h
+++ b/src/xml.h
@@ -13,7 +13,7 @@ struct wim_info {
 };
 
 /* xml.c */
-extern int xml_export_image(const struct wim_info *old_wim_info, int image, 
+extern int xml_export_image(const struct wim_info *old_wim_info, int image,
                            struct wim_info **new_wim_info_p,
                            const char *dest_image_name,
                            const char *dest_image_description);
@@ -30,7 +30,7 @@ extern void free_wim_info(struct wim_info *info);
 
 extern void print_image_info(const struct wim_info *wim_info, int image);
 
-extern int read_xml_data(FILE *fp, const struct resource_entry *res, 
+extern int read_xml_data(FILE *fp, const struct resource_entry *res,
                         u8 **xml_data_ret, struct wim_info **info_ret);
 
 extern int write_xml_data(const struct wim_info *wim_info, int image, FILE *out,
index a4dd756072440f0f2f7fc534820e3ae3df9863d0..f957862616e44d7aa7024634d188e75d22a941cf 100644 (file)
@@ -20,7 +20,7 @@
 #define XPRESS_MIN_MATCH       3
 #define XPRESS_MAX_MATCH       255
 
-extern int xpress_decompress(const void *__compressed_data, uint compressed_len, 
+extern int xpress_decompress(const void *__compressed_data, uint compressed_len,
                             void *__uncompressed_data, uint uncompressed_len);
 
 extern int xpress_compress(const void *uncompressed_data, uint uncompressed_len,
index 85c17b4d6219470d530e29ef00e01c2f8f8da8c1..2a4f7ec14f557a370fb5515888dece5eccd9352b 100755 (executable)
@@ -77,7 +77,7 @@ for comp_type in None LZX XPRESS; do
        if ! test "`readlink tmp/subdir/rel_symlink`" = "hello"; then
                error "Symlink target not correct"
        fi
-       
+
        rm -rf dir.wim tmp
 done
 
@@ -488,7 +488,7 @@ fi
 # We try with 5 different combinations of compression types to make sure we go
 # through all paths in the resource-handling code.
 for i in `seq 1 3`; do
-       case $i in 
+       case $i in
        1)
                cflag1="--compress=none";
                cflag2="--compress=none";
index 1012c344707b7abea53ca1c44d4722241bd7a48b..40c005cc9feccf943d2033d98454c9263e332c19 100755 (executable)
@@ -199,7 +199,7 @@ do_test 'echo 1 > file;
         setfattr -n user.aa -v 1111 file;
         setfattr -n user.aaa -v 1111 file;
         setfattr -n user.aaaa -v 1111 file;'
-       
+
 msg "file with named data streams with same contents as other file"
 do_test 'echo -n > file;
         setfattr -n user.a -v 1111 file;
@@ -236,7 +236,7 @@ do_test 'touch file;
         touch file2;
         setfattr -n system.ntfs_acl -v 0s`cat $srcdir/tests/security_descriptor_1.base64` file
         setfattr -n system.ntfs_acl -v 0s`cat $srcdir/tests/security_descriptor_2.base64` file'
-       
+
 msg "files with different security descriptors and some with the same security descriptor"
 do_test 'touch file;
         touch file2;
index a596962a45709822fc8ebba5dc6bc819743c31df..aed6ecb18358fb779bc833bcca91f7354f3c13e9 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * A program to compare directory trees
  *
  * There are two modes: