forked from pts/pts-tiny-7z-sfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7zFile.h
executable file
·76 lines (56 loc) · 1.33 KB
/
7zFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* 7zFile.h -- File IO
2009-11-24 : Igor Pavlov : Public domain */
#ifndef __7Z_FILE_H
#define __7Z_FILE_H
#ifdef _WIN32
#define USE_WINDOWS_FILE
#endif
#ifdef USE_WINDOWS_FILE
#include <windows.h>
#else
#include <stdio.h>
#endif
#include "Types.h"
EXTERN_C_BEGIN
/* ---------- File ---------- */
typedef struct
{
#ifdef USE_WINDOWS_FILE
HANDLE handle;
#else
FILE *file;
#endif
} CSzFile;
#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
STATIC WRes InFile_Open(CSzFile *p, const char *name);
STATIC WRes OutFile_Open(CSzFile *p, const char *name);
#endif
#ifdef USE_WINDOWS_FILE
STATIC WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
STATIC WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
#endif
STATIC WRes File_Close(CSzFile *p);
/* reads max(*size, remain file's size) bytes */
STATIC WRes File_Read(CSzFile *p, void *data, size_t *size);
/* writes *size bytes */
STATIC WRes File_Write(CSzFile *p, const void *data, size_t *size);
STATIC WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
/* ---------- FileInStream ---------- */
typedef struct
{
ISeqInStream s;
CSzFile file;
} CFileSeqInStream;
typedef struct
{
ISeekInStream s;
CSzFile file;
} CFileInStream;
STATIC void FileInStream_CreateVTable(CFileInStream *p);
typedef struct
{
ISeqOutStream s;
CSzFile file;
} CFileOutStream;
EXTERN_C_END
#endif