]> wimlib.net Git - wimlib/commitdiff
Fix UNIX build; rename functions; comments
authorEric Biggers <ebiggers3@gmail.com>
Sun, 17 Mar 2013 21:42:28 +0000 (16:42 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 17 Mar 2013 21:42:28 +0000 (16:42 -0500)
src/extract_image.c
src/win32.c
src/win32.h

index 7955417f88c0798255f5de04f6e8a72821995802..6279c4901c75402be3f7f96856fd32cd4be75ca1 100644 (file)
@@ -375,10 +375,10 @@ dir_exists:
 }
 
 #ifndef __WIN32__
-static int unix_apply_dentry(const char *output_path,
-                            size_t output_path_len,
-                            const struct wim_dentry *dentry,
-                            const struct apply_args *args)
+static int unix_do_apply_dentry(const char *output_path,
+                               size_t output_path_len,
+                               struct wim_dentry *dentry,
+                               struct apply_args *args)
 {
        const struct wim_inode *inode = dentry->d_inode;
 
@@ -392,12 +392,14 @@ static int unix_apply_dentry(const char *output_path,
                return extract_regular_file(dentry, args, output_path);
 }
 
-static int unix_apply_dentry_timestamps(const char *output_path,
-                                       size_t output_path_len,
-                                       const struct wim_dentry *dentry,
-                                       struct apply_args *args)
+static int unix_do_apply_dentry_timestamps(const char *output_path,
+                                          size_t output_path_len,
+                                          const struct wim_dentry *dentry,
+                                          struct apply_args *args)
 {
        int ret;
+       const struct wim_inode *inode = dentry->d_inode;
+
        /* Convert the WIM timestamps, which are accurate to 100 nanoseconds,
         * into struct timeval's. */
        struct timeval tv[2];
@@ -448,9 +450,9 @@ static int apply_dentry_normal(struct wim_dentry *dentry, void *arg)
                len += dentry->full_path_utf8_len;
        }
 #ifdef __WIN32__
-       return win32_apply_dentry(output_path, len, dentry, args);
+       return win32_do_apply_dentry(output_path, len, dentry, args);
 #else
-       return unix_apply_dentry(output_path, len, dentry, args);
+       return unix_do_apply_dentry(output_path, len, dentry, args);
 #endif
 }
 
@@ -473,9 +475,9 @@ static int apply_dentry_timestamps_normal(struct wim_dentry *dentry, void *arg)
                len += dentry->full_path_utf8_len;
        }
 #ifdef __WIN32__
-       return win32_apply_dentry_timestamps(output_path, len, dentry, args);
+       return win32_do_apply_dentry_timestamps(output_path, len, dentry, args);
 #else
-       return unix_apply_dentry_timestamps(output_path, len, dentry, args);
+       return unix_do_apply_dentry_timestamps(output_path, len, dentry, args);
 #endif
 }
 
index 775e782eedd9d576e8f6cdd72431948eb22db823..483518c99bab9c4c0609d9d39ae62f5c5fa5099f 100644 (file)
@@ -1068,10 +1068,12 @@ static int win32_set_security_data(const struct wim_inode *inode,
        return 0;
 }
 
-int win32_apply_dentry(const char *output_path,
-                      size_t output_path_len,
-                      const struct wim_dentry *dentry,
-                      struct apply_args *args)
+/* Extract a file, directory, reparse point, or hard link to an
+ * already-extracted file using the Win32 API */
+int win32_do_apply_dentry(const char *output_path,
+                         size_t output_path_len,
+                         struct wim_dentry *dentry,
+                         struct apply_args *args)
 {
        char *utf16_path;
        size_t utf16_path_len;
@@ -1133,10 +1135,11 @@ out:
        return ret;
 }
 
-int win32_apply_dentry_timestamps(const char *output_path,
-                                 size_t output_path_len,
-                                 const struct wim_dentry *dentry,
-                                 const struct apply_args *args)
+/* Set timestamps on an extracted file using the Win32 API */
+int win32_do_apply_dentry_timestamps(const char *output_path,
+                                    size_t output_path_len,
+                                    const struct wim_dentry *dentry,
+                                    const struct apply_args *args)
 {
        /* Win32 */
        char *utf16_path;
@@ -1208,6 +1211,7 @@ int fsync(int fd)
        return 0;
 }
 
+/* Use the Win32 API to get the number of processors */
 unsigned win32_get_number_of_processors()
 {
        SYSTEM_INFO sysinfo;
@@ -1215,6 +1219,9 @@ unsigned win32_get_number_of_processors()
        return sysinfo.dwNumberOfProcessors;
 }
 
+/* Replacement for POSIX-2008 realpath().  Warning: partial functionality only
+ * (resolved_path must be NULL).   Also I highly doubt that GetFullPathName
+ * really does the right thing under all circumstances. */
 char *realpath(const char *path, char *resolved_path)
 {
        DWORD ret;
index 084eb6b236fbe0d265a0929e4ba5fcd6aa2b4a28..496ee5c3d07e22ce889229d7bee6368b0d05cdf5 100644 (file)
@@ -36,15 +36,15 @@ extern int fnmatch(const char *pattern, const char *string, int flags);
 
 #define mkdir(name, mode) _mkdir(name)
 
-extern int win32_apply_dentry(const char *output_path,
-                             size_t output_path_len,
-                             const struct wim_dentry *dentry,
-                             struct apply_args *args);
-
-extern int win32_apply_dentry_timestamps(const char *output_path,
-                                        size_t output_path_len,
-                                        const struct wim_dentry *dentry,
-                                        const struct apply_args *args);
+extern int win32_do_apply_dentry(const char *output_path,
+                                size_t output_path_len,
+                                struct wim_dentry *dentry,
+                                struct apply_args *args);
+
+extern int win32_do_apply_dentry_timestamps(const char *output_path,
+                                           size_t output_path_len,
+                                           const struct wim_dentry *dentry,
+                                           const struct apply_args *args);
 
 extern int fsync(int fd);