OLD | NEW |
| (Empty) |
1 /* 7zFile.h -- File IO | |
2 2008-11-22 : 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 #endif | |
10 | |
11 #ifdef USE_WINDOWS_FILE | |
12 #include <windows.h> | |
13 #else | |
14 #include <stdio.h> | |
15 #endif | |
16 | |
17 #include "Types.h" | |
18 | |
19 | |
20 /* ---------- File ---------- */ | |
21 | |
22 typedef struct | |
23 { | |
24 #ifdef USE_WINDOWS_FILE | |
25 HANDLE handle; | |
26 #else | |
27 FILE *file; | |
28 #endif | |
29 } CSzFile; | |
30 | |
31 void File_Construct(CSzFile *p); | |
32 WRes InFile_Open(CSzFile *p, const char *name); | |
33 WRes OutFile_Open(CSzFile *p, const char *name); | |
34 WRes File_Close(CSzFile *p); | |
35 | |
36 /* reads max(*size, remain file's size) bytes */ | |
37 WRes File_Read(CSzFile *p, void *data, size_t *size); | |
38 | |
39 /* writes *size bytes */ | |
40 WRes File_Write(CSzFile *p, const void *data, size_t *size); | |
41 | |
42 WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin); | |
43 WRes File_GetLength(CSzFile *p, UInt64 *length); | |
44 | |
45 | |
46 /* ---------- FileInStream ---------- */ | |
47 | |
48 typedef struct | |
49 { | |
50 ISeqInStream s; | |
51 CSzFile file; | |
52 } CFileSeqInStream; | |
53 | |
54 void FileSeqInStream_CreateVTable(CFileSeqInStream *p); | |
55 | |
56 | |
57 typedef struct | |
58 { | |
59 ISeekInStream s; | |
60 CSzFile file; | |
61 } CFileInStream; | |
62 | |
63 void FileInStream_CreateVTable(CFileInStream *p); | |
64 | |
65 | |
66 typedef struct | |
67 { | |
68 ISeqOutStream s; | |
69 CSzFile file; | |
70 } CFileOutStream; | |
71 | |
72 void FileOutStream_CreateVTable(CFileOutStream *p); | |
73 | |
74 #endif | |
OLD | NEW |