RetroArch
7z.h
Go to the documentation of this file.
1 /* 7z.h -- 7z interface
2 2010-03-11 : Igor Pavlov : Public domain */
3 
4 #ifndef __7Z_H
5 #define __7Z_H
6 
7 #include "7zBuf.h"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define k7zStartHeaderSize 0x20
14 #define k7zSignatureSize 6
16 #define k7zMajorVersion 0
17 
18 enum EIdEnum
19 {
46 };
47 
48 typedef struct
49 {
54 } CSzCoderInfo;
55 
58 
59 typedef struct
60 {
63 } CSzBindPair;
64 
65 typedef struct
66 {
76 
78 } CSzFolder;
79 
85 
86 SRes SzFolder_Decode(const CSzFolder *folder, const uint64_t *packSizes,
87  ILookInStream *stream, uint64_t startPos,
88  uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain);
89 
90 typedef struct
91 {
95 
96 typedef struct
97 {
108 } CSzFileItem;
109 
110 void SzFile_Init(CSzFileItem *p);
111 
112 typedef struct
113 {
122 } CSzAr;
123 
124 void SzAr_Init(CSzAr *p);
125 void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
126 
127 
128 /*
129  SzExtract extracts file from archive
130 
131  *outBuffer must be 0 before first call for each new archive.
132 
133  Extracting cache:
134  If you need to decompress more than one file, you can send
135  these values from previous call:
136  *blockIndex,
137  *outBuffer,
138  *outBufferSize
139  You can consider "*outBuffer" as cache of solid block. If your archive is solid,
140  it will increase decompression speed.
141 
142  If you use external function, you can declare these 3 cache variables
143  (blockIndex, outBuffer, outBufferSize) as static in that external function.
144 
145  Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
146 */
147 
148 typedef struct
149 {
151 
154 
159 
160  size_t *FileNameOffsets; /* in 2-byte steps */
161  CBuf FileNames; /* UTF-16-LE */
162 } CSzArEx;
163 
164 void SzArEx_Init(CSzArEx *p);
165 void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
166 uint64_t SzArEx_GetFolderStreamPos(const CSzArEx *p, uint32_t folderIndex, uint32_t indexInFolder);
167 int SzArEx_GetFolderFullPackSize(const CSzArEx *p, uint32_t folderIndex, uint64_t *resSize);
168 
169 /*
170 if dest == NULL, the return value specifies the required size of the buffer,
171  in 16-bit characters, including the null-terminating character.
172 if dest != NULL, the return value specifies the number of 16-bit characters that
173  are written to the dest, including the null-terminating character. */
174 
175 size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, uint16_t *dest);
176 
178  const CSzArEx *db,
179  ILookInStream *inStream,
180  uint32_t fileIndex, /* index of file */
181  uint32_t *blockIndex, /* index of solid block */
182  uint8_t **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
183  size_t *outBufferSize, /* buffer size for output buffer */
184  size_t *offset, /* offset of stream for required file in *outBuffer */
185  size_t *outSizeProcessed, /* size of file in *outBuffer */
186  ISzAlloc *allocMain,
187  ISzAlloc *allocTemp);
188 
189 
190 /*
191 SzArEx_Open Errors:
192 SZ_ERROR_NO_ARCHIVE
193 SZ_ERROR_ARCHIVE
194 SZ_ERROR_UNSUPPORTED
195 SZ_ERROR_MEM
196 SZ_ERROR_CRC
197 SZ_ERROR_INPUT_EOF
198 SZ_ERROR_FAIL
199 */
200 
201 SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp);
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif
Definition: 7z.h:59
Definition: 7z.h:20
Definition: 7z.h:39
uint64_t dataPos
Definition: 7z.h:153
uint32_t * FolderStartPackStreamIndex
Definition: 7z.h:155
uint8_t HasStream
Definition: 7z.h:102
Definition: 7zTypes.h:162
int UnpackCRCDefined
Definition: 7z.h:74
uint32_t * PackCRCs
Definition: 7z.h:116
void SzAr_Init(CSzAr *p)
Definition: 7zIn.c:108
CSzAr db
Definition: 7z.h:150
Definition: 7z.h:24
uint32_t Crc
Definition: 7z.h:100
Definition: 7z.h:44
Definition: 7z.h:148
Definition: 7z.h:45
Definition: 7z.h:90
void SzFolder_Init(CSzFolder *p)
Definition: 7zIn.c:32
uint32_t Attrib
Definition: 7z.h:101
CSzCoderInfo * Coders
Definition: 7z.h:67
CBuf Props
Definition: 7z.h:53
void SzFile_Init(CSzFileItem *p)
Definition: 7zIn.c:99
uint64_t startPosAfterHeader
Definition: 7z.h:152
uint64_t * PackSizes
Definition: 7z.h:114
void SzArEx_Init(CSzArEx *p)
Definition: 7zIn.c:136
uint32_t NumPackStreams
Definition: 7z.h:119
size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, uint16_t *dest)
Definition: 7zIn.c:876
CSzFolder * Folders
Definition: 7z.h:117
CSzFileItem * Files
Definition: 7z.h:118
Definition: 7z.h:42
EIdEnum
Definition: 7z.h:18
uint8_t MTimeDefined
Definition: 7z.h:106
Definition: 7z.h:32
uint32_t NumUnpackStreams
Definition: 7z.h:77
CNtfsFileTime MTime
Definition: 7z.h:98
uint32_t NumOutStreams
Definition: 7z.h:51
Definition: 7z.h:22
void SzCoderInfo_Init(CSzCoderInfo *p)
Definition: 7zIn.c:21
size_t * FileNameOffsets
Definition: 7z.h:160
Definition: 7z.h:25
uint64_t MethodID
Definition: 7z.h:52
uint32_t * FileIndexToFolderIndexMap
Definition: 7z.h:158
Definition: 7z.h:21
Definition: 7z.h:35
uint32_t SzFolder_GetNumOutStreams(CSzFolder *p)
Definition: 7zIn.c:59
uint32_t * FolderStartFileIndex
Definition: 7z.h:157
Definition: 7z.h:28
uint64_t * UnpackSizes
Definition: 7z.h:70
uint32_t NumInStreams
Definition: 7z.h:50
SRes SzArEx_Extract(const CSzArEx *db, ILookInStream *inStream, uint32_t fileIndex, uint32_t *blockIndex, uint8_t **outBuffer, size_t *outBufferSize, size_t *offset, size_t *outSizeProcessed, ISzAlloc *allocMain, ISzAlloc *allocTemp)
Definition: 7zIn.c:1291
Definition: 7z.h:37
int SRes
Definition: 7zTypes.h:44
uint32_t NumFolders
Definition: 7z.h:120
uint32_t * PackStreams
Definition: 7z.h:69
uint32_t Low
Definition: 7z.h:92
Definition: 7z.h:36
Definition: 7z.h:40
Definition: 7z.h:41
uint8_t AttribDefined
Definition: 7z.h:107
Definition: 7z.h:43
int SzArEx_GetFolderFullPackSize(const CSzArEx *p, uint32_t folderIndex, uint64_t *resSize)
Definition: 7zIn.c:253
Definition: 7z.h:48
GLfloat GLfloat p
Definition: glext.h:9809
Definition: 7z.h:30
Definition: 7z.h:23
Definition: 7z.h:33
Definition: 7z.h:26
uint32_t NumCoders
Definition: 7z.h:71
uint64_t * PackStreamStartPositions
Definition: 7z.h:156
SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp)
Definition: 7zIn.c:1283
void SzAr_Free(CSzAr *p, ISzAlloc *alloc)
Definition: 7zIn.c:120
uint8_t * PackCRCsDefined
Definition: 7z.h:115
Definition: 7z.h:112
uint8_t k7zSignature[k7zSignatureSize]
Definition: 7zIn.c:11
uint32_t OutIndex
Definition: 7z.h:62
#define k7zSignatureSize
Definition: 7z.h:14
GLuint GLuint stream
Definition: glext.h:8189
int SzFolder_FindBindPairForInStream(CSzFolder *p, uint32_t inStreamIndex)
Definition: 7zIn.c:68
Definition: 7z.h:34
uint32_t NumPackStreams
Definition: 7z.h:73
Definition: 7z.h:38
CBuf FileNames
Definition: 7z.h:161
uint32_t InIndex
Definition: 7z.h:61
uint32_t High
Definition: 7z.h:93
uint32_t UnpackCRC
Definition: 7z.h:75
Definition: 7z.h:31
Definition: 7z.h:27
void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc)
Definition: 7zIn.c:147
Definition: 7z.h:65
GLintptr offset
Definition: glext.h:6560
uint64_t SzArEx_GetFolderStreamPos(const CSzArEx *p, uint32_t folderIndex, uint32_t indexInFolder)
Definition: 7zIn.c:247
uint64_t Size
Definition: 7z.h:99
unsigned short uint16_t
Definition: stdint.h:125
Definition: 7zTypes.h:106
Definition: 7z.h:29
unsigned __int64 uint64_t
Definition: stdint.h:136
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
uint32_t NumFiles
Definition: 7z.h:121
uint32_t NumBindPairs
Definition: 7z.h:72
Definition: 7zBuf.h:13
uint8_t IsDir
Definition: 7z.h:103
SRes SzFolder_Decode(const CSzFolder *folder, const uint64_t *packSizes, ILookInStream *stream, uint64_t startPos, uint8_t *outBuffer, size_t outSize, ISzAlloc *allocMain)
Definition: 7zDec.c:349
uint8_t CrcDefined
Definition: 7z.h:105
uint64_t SzFolder_GetUnpackSize(CSzFolder *p)
Definition: 7zIn.c:87
CSzBindPair * BindPairs
Definition: 7z.h:68
Definition: 7z.h:96
void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc)
Definition: 7zIn.c:26
uint8_t IsAnti
Definition: 7z.h:104