aboutsummaryrefslogtreecommitdiff
path: root/C/7zFile.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /C/7zFile.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.gz
7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.tar.bz2
7zip-f19f813537c7aea1c20749c914e756b54a9c3cf5.zip
'21.07'21.07
Diffstat (limited to 'C/7zFile.h')
-rw-r--r--C/7zFile.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/C/7zFile.h b/C/7zFile.h
new file mode 100644
index 0000000..788abb6
--- /dev/null
+++ b/C/7zFile.h
@@ -0,0 +1,91 @@
1/* 7zFile.h -- File IO
22021-02-15 : Igor Pavlov : Public domain */
3
4#ifndef __7Z_FILE_H
5#define __7Z_FILE_H
6
7#ifdef _WIN32
8#define USE_WINDOWS_FILE
9// #include <windows.h>
10#endif
11
12#ifdef USE_WINDOWS_FILE
13#include <windows.h>
14#else
15// note: USE_FOPEN mode is limited to 32-bit file size
16// #define USE_FOPEN
17// #include <stdio.h>
18#endif
19
20#include "7zTypes.h"
21
22EXTERN_C_BEGIN
23
24/* ---------- File ---------- */
25
26typedef struct
27{
28 #ifdef USE_WINDOWS_FILE
29 HANDLE handle;
30 #elif defined(USE_FOPEN)
31 FILE *file;
32 #else
33 int fd;
34 #endif
35} CSzFile;
36
37void File_Construct(CSzFile *p);
38#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
39WRes InFile_Open(CSzFile *p, const char *name);
40WRes OutFile_Open(CSzFile *p, const char *name);
41#endif
42#ifdef USE_WINDOWS_FILE
43WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
44WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
45#endif
46WRes File_Close(CSzFile *p);
47
48/* reads max(*size, remain file's size) bytes */
49WRes File_Read(CSzFile *p, void *data, size_t *size);
50
51/* writes *size bytes */
52WRes File_Write(CSzFile *p, const void *data, size_t *size);
53
54WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
55WRes File_GetLength(CSzFile *p, UInt64 *length);
56
57
58/* ---------- FileInStream ---------- */
59
60typedef struct
61{
62 ISeqInStream vt;
63 CSzFile file;
64 WRes wres;
65} CFileSeqInStream;
66
67void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
68
69
70typedef struct
71{
72 ISeekInStream vt;
73 CSzFile file;
74 WRes wres;
75} CFileInStream;
76
77void FileInStream_CreateVTable(CFileInStream *p);
78
79
80typedef struct
81{
82 ISeqOutStream vt;
83 CSzFile file;
84 WRes wres;
85} CFileOutStream;
86
87void FileOutStream_CreateVTable(CFileOutStream *p);
88
89EXTERN_C_END
90
91#endif