From 89cdef0859259fdea0165b0d3918777d1ed42955 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 12 Jun 2023 23:17:49 +0200 Subject: libsquashfs: Add sqfs_open_native_file function Having a function to interpret the flags and open a native file handle simplifies the istream/ostream/file code which shares that decoding part, particularly on windows where the character set needs to be transformed. Signed-off-by: David Oberhollenzer --- include/io/file.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'include/io') diff --git a/include/io/file.h b/include/io/file.h index fa0abc0..5065619 100644 --- a/include/io/file.h +++ b/include/io/file.h @@ -7,15 +7,7 @@ #ifndef IO_FILE_H #define IO_FILE_H -#include "io/istream.h" - -#if defined(_WIN32) || defined(__WINDOWS__) -#include - -typedef HANDLE os_file_t; -#else -typedef int os_file_t; -#endif +#include "sqfs/io.h" #ifdef __cplusplus extern "C" { @@ -36,7 +28,7 @@ extern "C" { * @return A pointer to an output stream on success, NULL on failure. */ SQFS_INTERNAL -sqfs_istream_t *istream_open_handle(const char *path, os_file_t fd); +sqfs_istream_t *istream_open_handle(const char *path, sqfs_file_handle_t fd); /** * @brief Create an output stream that writes to an OS native file handle. @@ -55,7 +47,7 @@ sqfs_istream_t *istream_open_handle(const char *path, os_file_t fd); * @return A pointer to an output stream on success, NULL on failure. */ SQFS_INTERNAL sqfs_ostream_t *ostream_open_handle(const char *path, - os_file_t hnd, + sqfs_file_handle_t hnd, int flags); /** -- cgit v1.2.3