lzma.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * LZMA support routines for PhysicsFS.
  3. *
  4. * Please see the file LICENSE in the source's root directory.
  5. *
  6. * This file written by Dennis Schridde, with some peeking at "7zMain.c"
  7. * by Igor Pavlov.
  8. */
  9. #if HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #if (defined PHYSFS_SUPPORTS_LZMA)
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include "physfs.h"
  17. #include "7zIn.h"
  18. #include "LzmaStateDecode.h"
  19. #define __PHYSICSFS_INTERNAL__
  20. #include "physfs_internal.h"
  21. #define LZMA_READBUFSIZE (16 * 1024)
  22. #define LZMA_7Z_FILE_SIG 0x7a37
  23. typedef struct
  24. {
  25. ISzInStream InStream;
  26. void *File;
  27. } CFileInStream;
  28. typedef struct
  29. {
  30. CArchiveDatabaseEx db;
  31. CFileInStream stream;
  32. struct _LZMAentry *firstEntry;
  33. struct _LZMAentry *lastEntry;
  34. } LZMAarchive;
  35. typedef struct _LZMAentry
  36. {
  37. LZMAarchive *archive;
  38. struct _LZMAentry *next;
  39. struct _LZMAentry *previous;
  40. CFileItem *file;
  41. CLzmaDecoderState state;
  42. PHYSFS_uint32 index;
  43. PHYSFS_uint32 folderIndex;
  44. PHYSFS_uint32 bufferedBytes;
  45. PHYSFS_uint32 compressedSize;
  46. PHYSFS_uint32 position;
  47. PHYSFS_uint32 compressedPosition;
  48. PHYSFS_uint8 buffer[LZMA_READBUFSIZE];
  49. PHYSFS_uint8 *bufferPos;
  50. } LZMAentry;
  51. static void *SzAllocPhysicsFS(size_t size)
  52. {
  53. return ((size == 0) ? NULL : allocator.Malloc(size));
  54. } /* SzAllocPhysicsFS */
  55. static void SzFreePhysicsFS(void *address)
  56. {
  57. if (address != NULL)
  58. allocator.Free(address);
  59. } /* SzFreePhysicsFS */
  60. SZ_RESULT SzFileReadImp(void *object, void *buffer,
  61. size_t size, size_t *processedSize)
  62. {
  63. CFileInStream *s = (CFileInStream *) object;
  64. size_t processedSizeLoc;
  65. processedSizeLoc = __PHYSFS_platformRead(s->File, buffer, size, 1) * size;
  66. if (processedSize != NULL)
  67. *processedSize = processedSizeLoc;
  68. return SZ_OK;
  69. } /* SzFileReadImp */
  70. SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
  71. {
  72. CFileInStream *s = (CFileInStream *) object;
  73. if (__PHYSFS_platformSeek(s->File, (PHYSFS_uint64) pos))
  74. return SZ_OK;
  75. return SZE_FAIL;
  76. } /* SzFileSeekImp */
  77. LZMAentry *lzma_find_entry(LZMAarchive *archive, const char *name)
  78. {
  79. /* !!! FIXME: don't malloc here */
  80. LZMAentry *entry = (LZMAentry *) allocator.Malloc(sizeof (LZMAentry));
  81. const PHYSFS_uint32 imax = archive->db.Database.NumFiles;
  82. for (entry->index = 0; entry->index < imax; entry->index++)
  83. {
  84. entry->file = archive->db.Database.Files + entry->index;
  85. if (strcmp(entry->file->Name, name) == 0)
  86. return entry;
  87. } /* for */
  88. allocator.Free(entry);
  89. BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
  90. } /* lzma_find_entry */
  91. static PHYSFS_sint32 lzma_find_start_of_dir(LZMAarchive *archive,
  92. const char *path,
  93. int stop_on_first_find)
  94. {
  95. PHYSFS_sint32 lo = 0;
  96. PHYSFS_sint32 hi = (PHYSFS_sint32) (archive->db.Database.NumFiles - 1);
  97. PHYSFS_sint32 middle;
  98. PHYSFS_uint32 dlen = strlen(path);
  99. PHYSFS_sint32 retval = -1;
  100. const char *name;
  101. int rc;
  102. if (*path == '\0') /* root dir? */
  103. return(0);
  104. if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
  105. dlen--;
  106. while (lo <= hi)
  107. {
  108. middle = lo + ((hi - lo) / 2);
  109. name = archive->db.Database.Files[middle].Name;
  110. rc = strncmp(path, name, dlen);
  111. if (rc == 0)
  112. {
  113. char ch = name[dlen];
  114. if ('/' < ch) /* make sure this isn't just a substr match. */
  115. rc = -1;
  116. else if ('/' > ch)
  117. rc = 1;
  118. else
  119. {
  120. if (stop_on_first_find) /* Just checking dir's existance? */
  121. return(middle);
  122. if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  123. return(middle + 1);
  124. /* there might be more entries earlier in the list. */
  125. retval = middle;
  126. hi = middle - 1;
  127. } /* else */
  128. } /* if */
  129. if (rc > 0)
  130. lo = middle + 1;
  131. else
  132. hi = middle - 1;
  133. } /* while */
  134. return(retval);
  135. } /* lzma_find_start_of_dir */
  136. /*
  137. * Wrap all 7z calls in this, so the physfs error state is set appropriately.
  138. */
  139. static int lzma_err(SZ_RESULT rc)
  140. {
  141. switch (rc)
  142. {
  143. case SZ_OK: /* Same as LZMA_RESULT_OK */
  144. break;
  145. case SZE_DATA_ERROR: /* Same as LZMA_RESULT_DATA_ERROR */
  146. __PHYSFS_setError(ERR_DATA_ERROR);
  147. break;
  148. case SZE_OUTOFMEMORY:
  149. __PHYSFS_setError(ERR_OUT_OF_MEMORY);
  150. break;
  151. case SZE_CRC_ERROR:
  152. __PHYSFS_setError(ERR_CORRUPTED);
  153. break;
  154. case SZE_NOTIMPL:
  155. __PHYSFS_setError(ERR_NOT_IMPLEMENTED);
  156. break;
  157. case SZE_FAIL:
  158. __PHYSFS_setError(ERR_UNKNOWN_ERROR); /* !!! FIXME: right? */
  159. break;
  160. case SZE_ARCHIVE_ERROR:
  161. __PHYSFS_setError(ERR_CORRUPTED); /* !!! FIXME: right? */
  162. break;
  163. default:
  164. __PHYSFS_setError(ERR_UNKNOWN_ERROR);
  165. } /* switch */
  166. return(rc);
  167. } /* lzma_err */
  168. static PHYSFS_sint64 LZMA_read(fvoid *opaque, void *outBuffer,
  169. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  170. {
  171. LZMAentry *entry = (LZMAentry *) opaque;
  172. size_t wantBytes = objSize * objCount;
  173. size_t decodedBytes = 0;
  174. size_t totalDecodedBytes = 0;
  175. size_t bufferBytes = 0;
  176. size_t usedBufferedBytes = 0;
  177. size_t availableBytes = entry->file->Size - entry->position;
  178. BAIL_IF_MACRO(wantBytes == 0, NULL, 0); /* quick rejection. */
  179. if (availableBytes < wantBytes)
  180. {
  181. wantBytes = availableBytes - (availableBytes % objSize);
  182. objCount = wantBytes / objSize;
  183. BAIL_IF_MACRO(objCount == 0, ERR_PAST_EOF, 0); /* quick rejection. */
  184. __PHYSFS_setError(ERR_PAST_EOF); /* this is always true here. */
  185. } /* if */
  186. while (totalDecodedBytes < wantBytes)
  187. {
  188. if (entry->bufferedBytes == 0)
  189. {
  190. bufferBytes = entry->compressedSize - entry->compressedPosition;
  191. if (bufferBytes > 0)
  192. {
  193. if (bufferBytes > LZMA_READBUFSIZE)
  194. bufferBytes = LZMA_READBUFSIZE;
  195. entry->bufferedBytes =
  196. __PHYSFS_platformRead(entry->archive->stream.File,
  197. entry->buffer, 1, bufferBytes);
  198. if (entry->bufferedBytes <= 0)
  199. break;
  200. entry->compressedPosition += entry->bufferedBytes;
  201. entry->bufferPos = entry->buffer;
  202. } /* if */
  203. } /* if */
  204. /* bufferedBytes == 0 if we finished decompressing */
  205. lzma_err(LzmaDecode(&entry->state,
  206. entry->bufferPos, entry->bufferedBytes, &usedBufferedBytes,
  207. outBuffer, wantBytes, &decodedBytes,
  208. (entry->bufferedBytes == 0)));
  209. entry->bufferedBytes -= usedBufferedBytes;
  210. entry->bufferPos += usedBufferedBytes;
  211. totalDecodedBytes += decodedBytes;
  212. entry->position += decodedBytes;
  213. } /* while */
  214. return(decodedBytes);
  215. } /* LZMA_read */
  216. static PHYSFS_sint64 LZMA_write(fvoid *opaque, const void *buf,
  217. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  218. {
  219. BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
  220. } /* LZMA_write */
  221. static int LZMA_eof(fvoid *opaque)
  222. {
  223. LZMAentry *entry = (LZMAentry *) opaque;
  224. return (entry->compressedPosition >= entry->compressedSize);
  225. } /* LZMA_eof */
  226. static PHYSFS_sint64 LZMA_tell(fvoid *opaque)
  227. {
  228. LZMAentry *entry = (LZMAentry *) opaque;
  229. return (entry->position);
  230. } /* LZMA_tell */
  231. static int LZMA_seek(fvoid *opaque, PHYSFS_uint64 offset)
  232. {
  233. LZMAentry *entry = (LZMAentry *) opaque;
  234. PHYSFS_uint8 buf[512];
  235. PHYSFS_uint32 maxread;
  236. BAIL_IF_MACRO(offset < 0, ERR_SEEK_OUT_OF_RANGE, 0);
  237. BAIL_IF_MACRO(offset > entry->file->Size, ERR_PAST_EOF, 0);
  238. if (offset < entry->position)
  239. {
  240. __PHYSFS_platformSeek(entry->archive->stream.File,
  241. SzArDbGetFolderStreamPos(&entry->archive->db,
  242. entry->folderIndex, 0));
  243. entry->position = 0;
  244. entry->compressedPosition = 0;
  245. LzmaDecoderInit(&entry->state);
  246. } /* if */
  247. while (offset != entry->position)
  248. {
  249. maxread = (PHYSFS_uint32) (offset - entry->position);
  250. if (maxread > sizeof (buf))
  251. maxread = sizeof (buf);
  252. if (!LZMA_read(entry, buf, maxread, 1))
  253. return(0);
  254. } /* while */
  255. return(1);
  256. } /* LZMA_seek */
  257. static PHYSFS_sint64 LZMA_fileLength(fvoid *opaque)
  258. {
  259. return ((LZMAentry *) opaque)->file->Size;
  260. } /* LZMA_fileLength */
  261. static int LZMA_fileClose(fvoid *opaque)
  262. {
  263. LZMAentry *entry = (LZMAentry *) opaque;
  264. /* Fix archive */
  265. if (entry == entry->archive->firstEntry)
  266. entry->archive->firstEntry = entry->next;
  267. if (entry == entry->archive->lastEntry)
  268. entry->archive->lastEntry = entry->previous;
  269. /* Fix neighbours */
  270. if (entry->previous != NULL)
  271. entry->previous->next = entry->next;
  272. if (entry->next != NULL)
  273. entry->next->previous = entry->previous;
  274. /* Free */
  275. if (entry->state.Probs != NULL)
  276. allocator.Free(entry->state.Probs);
  277. if (entry->state.Dictionary != NULL)
  278. allocator.Free(entry->state.Dictionary);
  279. allocator.Free(entry);
  280. return(1);
  281. } /* LZMA_fileClose */
  282. static int LZMA_isArchive(const char *filename, int forWriting)
  283. {
  284. PHYSFS_uint8 sig[k7zSignatureSize];
  285. PHYSFS_uint8 res;
  286. void *in;
  287. BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
  288. in = __PHYSFS_platformOpenRead(filename);
  289. BAIL_IF_MACRO(in == NULL, NULL, 0);
  290. if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
  291. BAIL_MACRO(NULL, 0);
  292. res = TestSignatureCandidate(sig);
  293. __PHYSFS_platformClose(in);
  294. return res;
  295. } /* LZMA_isArchive */
  296. static void *LZMA_openArchive(const char *name, int forWriting)
  297. {
  298. LZMAarchive *archive;
  299. ISzAlloc allocImp;
  300. ISzAlloc allocTempImp;
  301. BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, NULL);
  302. archive = (LZMAarchive *) allocator.Malloc(sizeof(LZMAarchive));
  303. if ((archive->stream.File = __PHYSFS_platformOpenRead(name)) == NULL)
  304. {
  305. allocator.Free(archive);
  306. return NULL;
  307. } /* if */
  308. archive->stream.InStream.Read = SzFileReadImp;
  309. archive->stream.InStream.Seek = SzFileSeekImp;
  310. archive->firstEntry = NULL;
  311. archive->lastEntry = NULL;
  312. allocImp.Alloc = SzAllocPhysicsFS;
  313. allocImp.Free = SzFreePhysicsFS;
  314. allocTempImp.Alloc = SzAllocPhysicsFS;
  315. allocTempImp.Free = SzFreePhysicsFS;
  316. InitCrcTable();
  317. SzArDbExInit(&archive->db);
  318. if (lzma_err(SzArchiveOpen(&archive->stream.InStream, &archive->db,
  319. &allocImp, &allocTempImp)) != SZ_OK)
  320. {
  321. SzArDbExFree(&archive->db, allocImp.Free);
  322. __PHYSFS_platformClose(archive->stream.File);
  323. allocator.Free(archive);
  324. return NULL;
  325. } /* if */
  326. return(archive);
  327. } /* LZMA_openArchive */
  328. /*
  329. * Moved to seperate function so we can use alloca then immediately throw
  330. * away the allocated stack space...
  331. */
  332. static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata,
  333. const char *odir, const char *str, PHYSFS_sint32 ln)
  334. {
  335. char *newstr = alloca(ln + 1);
  336. if (newstr == NULL)
  337. return;
  338. memcpy(newstr, str, ln);
  339. newstr[ln] = '\0';
  340. cb(callbackdata, odir, newstr);
  341. } /* doEnumCallback */
  342. static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
  343. int omitSymLinks, PHYSFS_EnumFilesCallback cb,
  344. const char *origdir, void *callbackdata)
  345. {
  346. LZMAarchive *archive = (LZMAarchive *) opaque;
  347. PHYSFS_sint32 dlen;
  348. PHYSFS_sint32 dlen_inc;
  349. PHYSFS_sint32 max;
  350. PHYSFS_sint32 i;
  351. i = lzma_find_start_of_dir(archive, dname, 0);
  352. if (i == -1) /* no such directory. */
  353. return;
  354. dlen = strlen(dname);
  355. if ((dlen > 0) && (dname[dlen - 1] == '/')) /* ignore trailing slash. */
  356. dlen--;
  357. dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
  358. max = (PHYSFS_sint32) archive->db.Database.NumFiles;
  359. while (i < max)
  360. {
  361. char *add;
  362. char *ptr;
  363. PHYSFS_sint32 ln;
  364. char *e = archive->db.Database.Files[i].Name;
  365. if ((dlen) && ((strncmp(e, dname, dlen)) || (e[dlen] != '/')))
  366. break; /* past end of this dir; we're done. */
  367. add = e + dlen_inc;
  368. ptr = strchr(add, '/');
  369. ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
  370. doEnumCallback(cb, callbackdata, origdir, add, ln);
  371. ln += dlen_inc; /* point past entry to children... */
  372. /* increment counter and skip children of subdirs... */
  373. while ((++i < max) && (ptr != NULL))
  374. {
  375. char *e_new = archive->db.Database.Files[i].Name;
  376. if ((strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
  377. break;
  378. } /* while */
  379. } /* while */
  380. } /* LZMA_enumerateFiles */
  381. static int LZMA_exists(dvoid *opaque, const char *name)
  382. {
  383. return(lzma_find_entry((LZMAarchive *) opaque, name) != NULL);
  384. } /* LZMA_exists */
  385. static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque,
  386. const char *name,
  387. int *fileExists)
  388. {
  389. BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); /* !!! FIXME: Implement this! */
  390. } /* LZMA_getLastModTime */
  391. static int LZMA_isDirectory(dvoid *opaque, const char *name, int *fileExists)
  392. {
  393. LZMAentry *entry = lzma_find_entry((LZMAarchive *) opaque, name);
  394. int isDir = entry->file->IsDirectory;
  395. *fileExists = (entry != NULL);
  396. allocator.Free(entry);
  397. return(isDir);
  398. } /* LZMA_isDirectory */
  399. static int LZMA_isSymLink(dvoid *opaque, const char *name, int *fileExists)
  400. {
  401. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  402. } /* LZMA_isSymLink */
  403. static fvoid *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
  404. {
  405. LZMAarchive *archive = (LZMAarchive *) opaque;
  406. LZMAentry *entry = lzma_find_entry(archive, name);
  407. BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
  408. entry->archive = archive;
  409. entry->compressedPosition = 0;
  410. entry->position = 0;
  411. entry->folderIndex =
  412. entry->archive->db.FileIndexToFolderIndexMap[entry->index];
  413. entry->next = NULL;
  414. entry->previous = entry->archive->lastEntry;
  415. if (entry->previous != NULL)
  416. entry->previous->next = entry;
  417. entry->archive->lastEntry = entry;
  418. if (entry->archive->firstEntry == NULL)
  419. entry->archive->firstEntry = entry;
  420. entry->bufferPos = entry->buffer;
  421. entry->bufferedBytes = 0;
  422. entry->compressedSize = SzArDbGetFolderFullPackSize(&entry->archive->db,
  423. entry->folderIndex);
  424. __PHYSFS_platformSeek(entry->archive->stream.File,
  425. SzArDbGetFolderStreamPos(&entry->archive->db,
  426. entry->folderIndex, 0));
  427. /* Create one CLzmaDecoderState per entry */
  428. CFolder *folder = entry->archive->db.Database.Folders + entry->folderIndex;
  429. CCoderInfo *coder = folder->Coders;
  430. if ((folder->NumPackStreams != 1) || (folder->NumCoders != 1))
  431. {
  432. LZMA_fileClose(entry);
  433. BAIL_MACRO(ERR_LZMA_NOTIMPL, NULL);
  434. } /* if */
  435. if (lzma_err(LzmaDecodeProperties(&entry->state.Properties, coder->Properties.Items, coder->Properties.Capacity)) != LZMA_RESULT_OK)
  436. return NULL;
  437. entry->state.Probs = (CProb *) allocator.Malloc(LzmaGetNumProbs(&entry->state.Properties) * sizeof(CProb));
  438. if (entry->state.Probs == NULL)
  439. {
  440. LZMA_fileClose(entry);
  441. BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
  442. } /* if */
  443. if (entry->state.Properties.DictionarySize == 0)
  444. entry->state.Dictionary = NULL;
  445. else
  446. {
  447. entry->state.Dictionary = (unsigned char *) allocator.Malloc(entry->state.Properties.DictionarySize);
  448. if (entry->state.Dictionary == NULL)
  449. {
  450. LZMA_fileClose(entry);
  451. BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
  452. } /* if */
  453. } /* else */
  454. LzmaDecoderInit(&entry->state);
  455. return(entry);
  456. } /* LZMA_openRead */
  457. static fvoid *LZMA_openWrite(dvoid *opaque, const char *filename)
  458. {
  459. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  460. } /* LZMA_openWrite */
  461. static fvoid *LZMA_openAppend(dvoid *opaque, const char *filename)
  462. {
  463. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  464. } /* LZMA_openAppend */
  465. static void LZMA_dirClose(dvoid *opaque)
  466. {
  467. LZMAarchive *archive = (LZMAarchive *) opaque;
  468. LZMAentry *entry = archive->firstEntry;
  469. while (entry != NULL)
  470. {
  471. entry = entry->next;
  472. LZMA_fileClose(entry->previous);
  473. } /* while */
  474. SzArDbExFree(&archive->db, SzFreePhysicsFS);
  475. __PHYSFS_platformClose(archive->stream.File);
  476. allocator.Free(archive);
  477. } /* LZMA_dirClose */
  478. static int LZMA_remove(dvoid *opaque, const char *name)
  479. {
  480. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  481. } /* LZMA_remove */
  482. static int LZMA_mkdir(dvoid *opaque, const char *name)
  483. {
  484. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  485. } /* LZMA_mkdir */
  486. const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA =
  487. {
  488. "7Z",
  489. LZMA_ARCHIVE_DESCRIPTION,
  490. "Dennis Schridde <devurandom@gmx.net>",
  491. "http://icculus.org/physfs/",
  492. };
  493. const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
  494. {
  495. &__PHYSFS_ArchiveInfo_LZMA,
  496. LZMA_isArchive, /* isArchive() method */
  497. LZMA_openArchive, /* openArchive() method */
  498. LZMA_enumerateFiles, /* enumerateFiles() method */
  499. LZMA_exists, /* exists() method */
  500. LZMA_isDirectory, /* isDirectory() method */
  501. LZMA_isSymLink, /* isSymLink() method */
  502. LZMA_getLastModTime, /* getLastModTime() method */
  503. LZMA_openRead, /* openRead() method */
  504. LZMA_openWrite, /* openWrite() method */
  505. LZMA_openAppend, /* openAppend() method */
  506. LZMA_remove, /* remove() method */
  507. LZMA_mkdir, /* mkdir() method */
  508. LZMA_dirClose, /* dirClose() method */
  509. LZMA_read, /* read() method */
  510. LZMA_write, /* write() method */
  511. LZMA_eof, /* eof() method */
  512. LZMA_tell, /* tell() method */
  513. LZMA_seek, /* seek() method */
  514. LZMA_fileLength, /* fileLength() method */
  515. LZMA_fileClose /* fileClose() method */
  516. };
  517. #endif /* defined PHYSFS_SUPPORTS_LZMA */
  518. /* end of lzma.c ... */