/** Patch version of the library (for example, the 5 in 1.2.5). */
#define WIMLIB_PATCH_VERSION 0
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Opaque structure that represents a WIM file. This is an in-memory structure
* and need not correspond to a specific on-disk file. However, a ::WIMStruct
* @}
*/
+/** Data for a ::WIMLIB_UPDATE_OP_ADD operation. */
+struct wimlib_add_command {
+ /** Filesystem path to the file or directory tree to
+ * add. */
+ wimlib_tchar *fs_source_path;
+ /** Path, specified from the root of the WIM image, at
+ * which to add the file or directory tree within the
+ * WIM image. */
+ wimlib_tchar *wim_target_path;
+
+ /** Configuration for excluded files. @c NULL means
+ * exclude no files (use no configuration), unless
+ * ::WIMLIB_ADD_FLAG_WINCONFIG is specified in @p
+ * add_flags. */
+ struct wimlib_capture_config *config;
+
+ /** Bitwise OR of WIMLIB_ADD_FLAG_* flags. */
+ int add_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_DELETE operation. */
+struct wimlib_delete_command {
+ /** Path, specified from the root of the WIM image, for
+ * the file or directory tree within the WIM image to be
+ * deleted. */
+ wimlib_tchar *wim_path;
+ /** Bitwise OR of WIMLIB_DELETE_FLAG_* flags. */
+ int delete_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_RENAME operation. */
+struct wimlib_rename_command {
+ /** Path, specified from the root of the WIM image, for
+ * the source file or directory tree within the WIM
+ * image. */
+ wimlib_tchar *wim_source_path;
+ /** Path, specified from the root of the WIM image, for
+ * the destination file or directory tree within the WIM
+ * image. */
+ wimlib_tchar *wim_target_path;
+ /** Reserved; set to 0. */
+ int rename_flags;
+};
+
/** Specification of an update to perform on a WIM image. */
struct wimlib_update_command {
WIMLIB_UPDATE_OP_RENAME,
} op;
union {
- /** Data for a ::WIMLIB_UPDATE_OP_ADD operation. */
- struct wimlib_add_command {
- /** Filesystem path to the file or directory tree to
- * add. */
- wimlib_tchar *fs_source_path;
- /** Path, specified from the root of the WIM image, at
- * which to add the file or directory tree within the
- * WIM image. */
- wimlib_tchar *wim_target_path;
-
- /** Configuration for excluded files. @c NULL means
- * exclude no files (use no configuration), unless
- * ::WIMLIB_ADD_FLAG_WINCONFIG is specified in @p
- * add_flags. */
- struct wimlib_capture_config *config;
-
- /** Bitwise OR of WIMLIB_ADD_FLAG_* flags. */
- int add_flags;
- } add;
- /** Data for a ::WIMLIB_UPDATE_OP_DELETE operation. */
- struct wimlib_delete_command {
- /** Path, specified from the root of the WIM image, for
- * the file or directory tree within the WIM image to be
- * deleted. */
- wimlib_tchar *wim_path;
- /** Bitwise OR of WIMLIB_DELETE_FLAG_* flags. */
- int delete_flags;
- } delete;
- /** Data for a ::WIMLIB_UPDATE_OP_RENAME operation. */
- struct wimlib_rename_command {
- /** Path, specified from the root of the WIM image, for
- * the source file or directory tree within the WIM
- * image. */
- wimlib_tchar *wim_source_path;
- /** Path, specified from the root of the WIM image, for
- * the destination file or directory tree within the WIM
- * image. */
- wimlib_tchar *wim_target_path;
- /** Reserved; set to 0. */
- int rename_flags;
- } rename;
+ struct wimlib_add_command add;
+ struct wimlib_delete_command delete_; /* Underscore is for C++
+ compatibility. */
+ struct wimlib_rename_command rename;
};
};
wimlib_xpress_decompress(const void *compressed_data, unsigned compressed_len,
void *uncompressed_data, unsigned uncompressed_len);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _WIMLIB_H */
case WIMLIB_UPDATE_OP_DELETE:
imagex_printf(T("Deleted WIM path "
"\""WIMLIB_WIM_PATH_SEPARATOR_STRING "%"TS"\"\n"),
- info->update.command->delete.wim_path);
+ info->update.command->delete_.wim_path);
break;
case WIMLIB_UPDATE_OP_RENAME:
imagex_printf(T("Renamed WIM path "
break;
case WIMLIB_UPDATE_OP_DELETE:
if (!tstrcmp(option, T("--force")))
- cmd->delete.delete_flags |= WIMLIB_DELETE_FLAG_FORCE;
+ cmd->delete_.delete_flags |= WIMLIB_DELETE_FLAG_FORCE;
else if (!tstrcmp(option, T("--recursive")))
- cmd->delete.delete_flags |= WIMLIB_DELETE_FLAG_RECURSIVE;
+ cmd->delete_.delete_flags |= WIMLIB_DELETE_FLAG_RECURSIVE;
else
recognized = false;
break;
cmd->add.wim_target_path = (tchar*)nonoption;
break;
case WIMLIB_UPDATE_OP_DELETE:
- cmd->delete.wim_path = (tchar*)nonoption;
+ cmd->delete_.wim_path = (tchar*)nonoption;
break;
case WIMLIB_UPDATE_OP_RENAME:
if (num_nonoptions == 0)
cmds[i].add.config = config;
break;
case WIMLIB_UPDATE_OP_DELETE:
- cmds[i].delete.delete_flags |= default_delete_flags;
+ cmds[i].delete_.delete_flags |= default_delete_flags;
break;
default:
break;
bool is_root;
wimlib_assert(delete_cmd->op == WIMLIB_UPDATE_OP_DELETE);
- flags = delete_cmd->delete.delete_flags;
- wim_path = delete_cmd->delete.wim_path;
+ flags = delete_cmd->delete_.delete_flags;
+ wim_path = delete_cmd->delete_.wim_path;
DEBUG("Deleting WIM path \"%"TS"\" (flags=%#x)", wim_path, flags);
free_capture_config(cmds[i].add.config);
break;
case WIMLIB_UPDATE_OP_DELETE:
- FREE(cmds[i].delete.wim_path);
+ FREE(cmds[i].delete_.wim_path);
break;
case WIMLIB_UPDATE_OP_RENAME:
FREE(cmds[i].rename.wim_source_path);
cmds_copy[i].add.add_flags = cmds[i].add.add_flags;
break;
case WIMLIB_UPDATE_OP_DELETE:
- cmds_copy[i].delete.wim_path =
- canonicalize_wim_path(cmds[i].delete.wim_path);
- if (!cmds_copy[i].delete.wim_path)
+ cmds_copy[i].delete_.wim_path =
+ canonicalize_wim_path(cmds[i].delete_.wim_path);
+ if (!cmds_copy[i].delete_.wim_path)
goto oom;
- cmds_copy[i].delete.delete_flags = cmds[i].delete.delete_flags;
+ cmds_copy[i].delete_.delete_flags = cmds[i].delete_.delete_flags;
break;
case WIMLIB_UPDATE_OP_RENAME:
cmds_copy[i].rename.wim_source_path =