]> wimlib.net Git - wimlib/commitdiff
Clean up headers
authorEric Biggers <ebiggers3@gmail.com>
Mon, 18 Mar 2013 01:52:37 +0000 (20:52 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 18 Mar 2013 01:52:37 +0000 (20:52 -0500)
src/add_image.c
src/extract_image.c
src/header.c
src/mount_image.c
src/ntfs-capture.c
src/util.h
src/wim.c
src/win32.c
src/win32.h

index 8af2b0728fff2e016226dccba72e6ce5daac2926..7c974992e6cd4e1e1d3008d0c6e6586c4ef99169 100644 (file)
@@ -598,6 +598,8 @@ static bool match_pattern(const char *path, const char *path_basename,
                                string = path_basename;
                }
 
+               /* Warning: on Windows native builds, fnmatch() calls the
+                * replacement function in win32.c. */
                if (fnmatch(pat, string, FNM_PATHNAME
                                #ifdef FNM_CASEFOLD
                                        | FNM_CASEFOLD
index 6279c4901c75402be3f7f96856fd32cd4be75ca1..dece5437efb0c338687afdaea6c660a00c1f5084 100644 (file)
@@ -42,7 +42,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-
 #include <unistd.h>
 
 #include "dentry.h"
@@ -435,7 +434,6 @@ static int unix_do_apply_dentry_timestamps(const char *output_path,
 static int apply_dentry_normal(struct wim_dentry *dentry, void *arg)
 {
        struct apply_args *args = arg;
-       struct wim_inode *inode = dentry->d_inode;
        size_t len;
        char *output_path;
 
index db791cc56024aac3e1dec45512e04f4d53d4119b..7ac84160d210828901c06b2c2c78141e01043b20 100644 (file)
@@ -274,7 +274,7 @@ WIMLIBAPI void wimlib_print_header(const WIMStruct *w)
        printf("Lookup Table Size           = %"PRIu64"\n",
                                (u64)hdr->lookup_table_res_entry.size);
        printf("Lookup Table Flags          = 0x%hhx\n",
-                               hdr->lookup_table_res_entry.flags);
+                               (u8)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",
@@ -282,7 +282,7 @@ WIMLIBAPI void wimlib_print_header(const WIMStruct *w)
        printf("XML Data Size               = %"PRIu64"\n",
                                (u64)hdr->xml_res_entry.size);
        printf("XML Data Flags              = 0x%hhx\n",
-                               hdr->xml_res_entry.flags);
+                               (u8)hdr->xml_res_entry.flags);
        printf("XML Data Offset             = %"PRIu64"\n",
                                hdr->xml_res_entry.offset);
        printf("XML Data Original Size      = %"PRIu64"\n",
@@ -290,18 +290,18 @@ WIMLIBAPI void wimlib_print_header(const WIMStruct *w)
        printf("Boot Metadata Size          = %"PRIu64"\n",
                                (u64)hdr->boot_metadata_res_entry.size);
        printf("Boot Metadata Flags         = 0x%hhx\n",
-                               hdr->boot_metadata_res_entry.flags);
+                               (u8)hdr->boot_metadata_res_entry.flags);
        printf("Boot Metadata Offset        = %"PRIu64"\n",
                                hdr->boot_metadata_res_entry.offset);
        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",
-                                       (u64)hdr->integrity.size);
+                               (u64)hdr->integrity.size);
        printf("Integrity Flags             = 0x%hhx\n",
-                                       hdr->integrity.flags);
+                               (u8)hdr->integrity.flags);
        printf("Integrity Offset            = %"PRIu64"\n",
-                                       hdr->integrity.offset);
+                               hdr->integrity.offset);
        printf("Integrity Original_size     = %"PRIu64"\n",
-                                       hdr->integrity.original_size);
+                               hdr->integrity.original_size);
 }
index a17bf5026cc360c6491732d9d3a42ba15305b8b3..afb090501e004e6769ad134715cf5b70abeed756 100644 (file)
 
 #ifdef WITH_FUSE
 
-#include "sha1.h"
-#include "lookup_table.h"
-#include "xml.h"
 #include "buffer_io.h"
+#include "lookup_table.h"
+#include "sha1.h"
 #include "timestamp.h"
+#include "xml.h"
+
+#include <errno.h>
+#include <ftw.h>
 #include <limits.h>
+#include <mqueue.h>
+#include <signal.h>
 #include <stdlib.h>
-#include <unistd.h>
-#include <sys/wait.h>
-#define FUSE_USE_VERSION 26
-#include <errno.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <sys/time.h>
-#include <fuse.h>
-#include <ftw.h>
-#include <mqueue.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
 #include <utime.h>
-#include <signal.h>
+
+#define FUSE_USE_VERSION 26
+#include <fuse.h>
 
 #ifdef ENABLE_XATTR
 #include <attr/xattr.h>
index 70ce59a96a3bf765203bd5ff2394abaebb235b47..d692633ab490200667c1d68aac443fa47b417464 100644 (file)
 #include <ntfs-3g/endians.h>
 #include <ntfs-3g/types.h>
 
-#include "wimlib_internal.h"
-
-
+#include "buffer_io.h"
 #include "dentry.h"
 #include "lookup_table.h"
-#include "buffer_io.h"
+#include "security.h"
+#include "wimlib_internal.h"
+
 #include <ntfs-3g/layout.h>
 #include <ntfs-3g/acls.h>
 #include <ntfs-3g/attrib.h>
 #include <ntfs-3g/misc.h>
 #include <ntfs-3g/reparse.h>
-#include <ntfs-3g/security.h> /* security.h before xattrs.h */
+#include <ntfs-3g/security.h> /* ntfs-3g/security.h before ntfs-3g/xattrs.h */
 #include <ntfs-3g/xattrs.h>
 #include <ntfs-3g/volume.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
-#include "security.h"
+
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 
 static inline ntfschar *attr_record_name(ATTR_RECORD *ar)
 {
index b56fa4fa33e487350a249607a65b5723d3f0c132..c51fc710a8615a414607da5dcec3a95e18e5f54e 100644 (file)
@@ -108,10 +108,10 @@ extern void wimlib_warning_with_errno(const char *format, ...)
 #      define WARNING                  wimlib_warning
 #      define WARNING_WITH_ERRNO       wimlib_warning
 #else
-#      define ERROR(format, ...)               dummy_printf
-#      define ERROR_WITH_ERRNO(format, ...)    dummy_printf
-#      define WARNING(format, ...)             dummy_printf
-#      define WARNING_WITH_ERRNO(format, ...)  dummy_printf
+#      define ERROR(format, ...)               dummy_printf(format, ## __VA_ARGS__)
+#      define ERROR_WITH_ERRNO(format, ...)    dummy_printf(format, ## __VA_ARGS__)
+#      define WARNING(format, ...)             dummy_printf(format, ## __VA_ARGS__)
+#      define WARNING_WITH_ERRNO(format, ...)  dummy_printf(format, ## __VA_ARGS__)
 #endif /* ENABLE_ERROR_MESSAGES */
 
 #if defined(ENABLE_DEBUG) || defined(ENABLE_MORE_DEBUG)
index 70e8e73bcfde117136bf56aa8f5f75781a145b26..60b2b57e8908ca50d9927508a840b40f4982820a 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -452,6 +452,9 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags,
         *
         * This will break if the full path to the WIM changes in the
         * intervening time...
+        *
+        * Warning: in Windows native builds, realpath() calls the replacement
+        * function in win32.c.
         */
        w->filename = realpath(in_wim_path, NULL);
        if (!w->filename) {
index 483518c99bab9c4c0609d9d39ae62f5c5fa5099f..16bdf79c7792f1b1999b54b009b256ecd2f1dd0c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * win32.c
  *
- * All the code specific to native Windows builds is in here.
+ * All the library code specific to native Windows builds is in here.
  */
 
 /*
 #include <windows.h>
 #include <ntdef.h>
 #include <wchar.h>
-#include <shlwapi.h>
-#ifdef ERROR
+#include <shlwapi.h> /* shlwapi.h for PathMatchSpecA() */
+#ifdef ERROR /* windows.h defines this */
 #  undef ERROR
 #endif
 
-
-/* Microsoft's swprintf() violates the C standard and they require programmers
- * to do this weird define to get the correct function.  */
-#define swprintf _snwprintf
-
 #include "win32.h"
 #include "dentry.h"
 #include "lookup_table.h"
@@ -64,8 +59,6 @@ void win32_error(u32 err_code)
                LocalFree(buffer);
        }
 }
-#else
-#define win32_error(err_code)
 #endif
 
 void *win32_open_file_readonly(const void *path)
@@ -191,16 +184,6 @@ static u64 FILETIME_to_u64(const FILETIME *ft)
        return ((u64)ft->dwHighDateTime << 32) | (u64)ft->dwLowDateTime;
 }
 
-
-int win32_build_dentry_tree(struct wim_dentry **root_ret,
-                           const char *root_disk_path,
-                           struct wim_lookup_table *lookup_table,
-                           struct wim_security_data *sd,
-                           const struct capture_config *config,
-                           int add_image_flags,
-                           wimlib_progress_func_t progress_func,
-                           void *extra_arg);
-
 static int win32_get_short_name(struct wim_dentry *dentry,
                                const wchar_t *path_utf16)
 {
@@ -260,7 +243,7 @@ static int win32_get_security_descriptor(struct wim_dentry *dentry,
 }
 
 /* Reads the directory entries of directory using a Win32 API and recursively
- * calls build_dentry_tree() on them. */
+ * calls win32_build_dentry_tree() on them. */
 static int win32_recurse_directory(struct wim_dentry *root,
                                   const char *root_disk_path,
                                   struct wim_lookup_table *lookup_table,
@@ -777,7 +760,7 @@ out:
 }
 
 /* Replacement for POSIX fnmatch() (partial functionality only) */
-extern int fnmatch(const char *pattern, const char *string, int flags)
+int fnmatch(const char *pattern, const char *string, int flags)
 {
        if (PathMatchSpecA(string, pattern))
                return 0;
index 496ee5c3d07e22ce889229d7bee6368b0d05cdf5..5f4ff567036fb13269257532932a24b1acfb93fc 100644 (file)
@@ -34,8 +34,6 @@ extern void win32_error(u32 err);
 #define FNM_NOMATCH 1
 extern int fnmatch(const char *pattern, const char *string, int flags);
 
-#define mkdir(name, mode) _mkdir(name)
-
 extern int win32_do_apply_dentry(const char *output_path,
                                 size_t output_path_len,
                                 struct wim_dentry *dentry,
@@ -52,4 +50,11 @@ extern unsigned win32_get_number_of_processors();
 
 extern char *realpath(const char *path, char *resolved_path);
 
+/* Microsoft's swprintf() violates the C standard and they require programmers
+ * to do this weird define to get the correct function.  */
+#define swprintf _snwprintf
+
+/* Use Microsoft's weird _mkdir() function instead of mkdir() */
+#define mkdir(name, mode) _mkdir(name)
+
 #endif /* _WIMLIB_WIN32_H */