Move WIN32-backend-specific definitions into their common header.
diff --git a/lib/zipint.h b/lib/zipint.h index 589a1ef..edfc455 100644 --- a/lib/zipint.h +++ b/lib/zipint.h
@@ -392,50 +392,6 @@ #define ZIP_SOURCE_IS_OPEN_WRITING(src) ((src)->write_state == ZIP_SOURCE_WRITE_OPEN) #define ZIP_SOURCE_IS_LAYERED(src) ((src)->src != NULL) -#ifdef _WIN32 - -/* context for Win32 source */ - -struct _zip_source_win32_file_ops; - -struct _zip_source_win32_read_file { - zip_error_t error; /* last error information */ - DWORD win32err; /* last Win32 error */ - zip_int64_t supports; - - /* operations */ - struct _zip_source_win32_file_ops *ops; - - /* reading */ - void *fname; /* name of file to read from - ANSI (char *) or Unicode (wchar_t *) */ - void *h; /* HANDLE for file to read from */ - int closep; /* whether to close f on ZIP_CMD_FREE */ - struct zip_stat st; /* stat information passed in */ - zip_uint64_t start; /* start offset of data to read */ - zip_uint64_t end; /* end offset of data to read, 0 for up to EOF */ - zip_uint64_t current; /* current offset */ - - /* writing */ - void *tmpname; /* name of temp file - ANSI (char *) or Unicode (wchar_t *) */ - void *hout; /* HANDLE for output file */ -}; - -typedef struct _zip_source_win32_read_file _zip_source_win32_read_file_t; - -/* internal operations for Win32 source */ - -struct _zip_source_win32_file_ops { - void *(*op_strdup)(const void *str); - void *(*op_open)(_zip_source_win32_read_file_t *ctx); - void *(*op_create_temp)(_zip_source_win32_read_file_t *ctx, void **temp, zip_uint32_t value); - int (*op_rename_temp)(_zip_source_win32_read_file_t *ctx); - int (*op_remove)(const void *fname); -}; - -typedef struct _zip_source_win32_file_ops _zip_source_win32_file_ops_t; - -#endif - /* entry in zip archive directory */ struct zip_entry { @@ -607,8 +563,4 @@ void _zip_unchange_data(zip_entry_t *); int _zip_write(zip_t *za, const void *data, zip_uint64_t length); -#ifdef _WIN32 -zip_source_t *_zip_source_win32_handle_or_name(const void *fname, void *h, zip_uint64_t start, zip_int64_t len, int closep, const zip_stat_t *st, _zip_source_win32_file_ops_t *ops, zip_error_t *error); -#endif - #endif /* zipint.h */
diff --git a/lib/zipwin32.h b/lib/zipwin32.h index 2f21168..c84e1e8 100644 --- a/lib/zipwin32.h +++ b/lib/zipwin32.h
@@ -40,4 +40,46 @@ #define _WIN32_WINDOWS 0x0500 #include <windows.h> +/* context for Win32 source */ + +struct _zip_source_win32_file_ops; + +struct _zip_source_win32_read_file { + zip_error_t error; /* last error information */ + DWORD win32err; /* last Win32 error */ + zip_int64_t supports; + + /* operations */ + struct _zip_source_win32_file_ops *ops; + + /* reading */ + void *fname; /* name of file to read from - ANSI (char *) or Unicode (wchar_t *) */ + void *h; /* HANDLE for file to read from */ + int closep; /* whether to close f on ZIP_CMD_FREE */ + struct zip_stat st; /* stat information passed in */ + zip_uint64_t start; /* start offset of data to read */ + zip_uint64_t end; /* end offset of data to read, 0 for up to EOF */ + zip_uint64_t current; /* current offset */ + + /* writing */ + void *tmpname; /* name of temp file - ANSI (char *) or Unicode (wchar_t *) */ + void *hout; /* HANDLE for output file */ +}; + +typedef struct _zip_source_win32_read_file _zip_source_win32_read_file_t; + +/* internal operations for Win32 source */ + +struct _zip_source_win32_file_ops { + void *(*op_strdup)(const void *); + void *(*op_open)(_zip_source_win32_read_file_t *); + void *(*op_create_temp)(_zip_source_win32_read_file_t *, void **, zip_uint32_t); + int (*op_rename_temp)(_zip_source_win32_read_file_t *); + int (*op_remove)(const void *); +}; + +typedef struct _zip_source_win32_file_ops _zip_source_win32_file_ops_t; + +zip_source_t *_zip_source_win32_handle_or_name(const void *, void *, zip_uint64_t, zip_int64_t, int, const zip_stat_t *, _zip_source_win32_file_ops_t *, zip_error_t *); + #endif /* zipwin32.h */