qpak.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. /*
  2. * QPAK support routines for PhysicsFS.
  3. *
  4. * This archiver handles the archive format utilized by Quake 1 and 2.
  5. * Quake3-based games use the PkZip/Info-Zip format (which our zip.c
  6. * archiver handles).
  7. *
  8. * ========================================================================
  9. *
  10. * This format info (in more detail) comes from:
  11. * http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/pak.txt
  12. *
  13. * Quake PAK Format
  14. *
  15. * Header
  16. * (4 bytes) signature = 'PACK'
  17. * (4 bytes) directory offset
  18. * (4 bytes) directory length
  19. *
  20. * Directory
  21. * (56 bytes) file name
  22. * (4 bytes) file position
  23. * (4 bytes) file length
  24. *
  25. * ========================================================================
  26. *
  27. * Please see the file LICENSE in the source's root directory.
  28. *
  29. * This file written by Ryan C. Gordon.
  30. */
  31. #if HAVE_CONFIG_H
  32. # include <config.h>
  33. #endif
  34. #if (defined PHYSFS_SUPPORTS_QPAK)
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <string.h>
  38. #include "physfs.h"
  39. #define __PHYSICSFS_INTERNAL__
  40. #include "physfs_internal.h"
  41. #if 1 /* Make this case insensitive? */
  42. #define QPAK_strcmp(x, y) __PHYSFS_platformStricmp(x, y)
  43. #define QPAK_strncmp(x, y, z) __PHYSFS_platformStrnicmp(x, y, z)
  44. #else
  45. #define QPAK_strcmp(x, y) strcmp(x, y)
  46. #define QPAK_strncmp(x, y, z) strncmp(x, y, z)
  47. #endif
  48. typedef struct
  49. {
  50. char name[56];
  51. PHYSFS_uint32 startPos;
  52. PHYSFS_uint32 size;
  53. } QPAKentry;
  54. typedef struct
  55. {
  56. char *filename;
  57. PHYSFS_sint64 last_mod_time;
  58. PHYSFS_uint32 entryCount;
  59. QPAKentry *entries;
  60. } QPAKinfo;
  61. typedef struct
  62. {
  63. void *handle;
  64. QPAKentry *entry;
  65. PHYSFS_uint32 curPos;
  66. } QPAKfileinfo;
  67. /* Magic numbers... */
  68. #define QPAK_SIGNATURE 0x4b434150 /* "PACK" in ASCII. */
  69. static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
  70. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
  71. static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
  72. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
  73. static int QPAK_eof(fvoid *opaque);
  74. static PHYSFS_sint64 QPAK_tell(fvoid *opaque);
  75. static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset);
  76. static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque);
  77. static int QPAK_fileClose(fvoid *opaque);
  78. static int QPAK_isArchive(const char *filename, int forWriting);
  79. static void *QPAK_openArchive(const char *name, int forWriting);
  80. static LinkedStringList *QPAK_enumerateFiles(dvoid *opaque,
  81. const char *dirname,
  82. int omitSymLinks);
  83. static int QPAK_exists(dvoid *opaque, const char *name);
  84. static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists);
  85. static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists);
  86. static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque, const char *n, int *e);
  87. static fvoid *QPAK_openRead(dvoid *opaque, const char *name, int *exist);
  88. static fvoid *QPAK_openWrite(dvoid *opaque, const char *name);
  89. static fvoid *QPAK_openAppend(dvoid *opaque, const char *name);
  90. static int QPAK_remove(dvoid *opaque, const char *name);
  91. static int QPAK_mkdir(dvoid *opaque, const char *name);
  92. static void QPAK_dirClose(dvoid *opaque);
  93. const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
  94. {
  95. "PAK",
  96. QPAK_ARCHIVE_DESCRIPTION,
  97. "Ryan C. Gordon <icculus@clutteredmind.org>",
  98. "http://icculus.org/physfs/",
  99. };
  100. const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
  101. {
  102. &__PHYSFS_ArchiveInfo_QPAK,
  103. QPAK_isArchive, /* isArchive() method */
  104. QPAK_openArchive, /* openArchive() method */
  105. QPAK_enumerateFiles, /* enumerateFiles() method */
  106. QPAK_exists, /* exists() method */
  107. QPAK_isDirectory, /* isDirectory() method */
  108. QPAK_isSymLink, /* isSymLink() method */
  109. QPAK_getLastModTime, /* getLastModTime() method */
  110. QPAK_openRead, /* openRead() method */
  111. QPAK_openWrite, /* openWrite() method */
  112. QPAK_openAppend, /* openAppend() method */
  113. QPAK_remove, /* remove() method */
  114. QPAK_mkdir, /* mkdir() method */
  115. QPAK_dirClose, /* dirClose() method */
  116. QPAK_read, /* read() method */
  117. QPAK_write, /* write() method */
  118. QPAK_eof, /* eof() method */
  119. QPAK_tell, /* tell() method */
  120. QPAK_seek, /* seek() method */
  121. QPAK_fileLength, /* fileLength() method */
  122. QPAK_fileClose /* fileClose() method */
  123. };
  124. static void QPAK_dirClose(dvoid *opaque)
  125. {
  126. QPAKinfo *info = ((QPAKinfo *) opaque);
  127. free(info->filename);
  128. free(info->entries);
  129. free(info);
  130. } /* QPAK_dirClose */
  131. static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
  132. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  133. {
  134. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  135. QPAKentry *entry = finfo->entry;
  136. PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
  137. PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
  138. PHYSFS_sint64 rc;
  139. if (objsLeft < objCount)
  140. objCount = objsLeft;
  141. rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
  142. if (rc > 0)
  143. finfo->curPos += (PHYSFS_uint32) (rc * objSize);
  144. return(rc);
  145. } /* QPAK_read */
  146. static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
  147. PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  148. {
  149. BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
  150. } /* QPAK_write */
  151. static int QPAK_eof(fvoid *opaque)
  152. {
  153. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  154. QPAKentry *entry = finfo->entry;
  155. return(finfo->curPos >= entry->size);
  156. } /* QPAK_eof */
  157. static PHYSFS_sint64 QPAK_tell(fvoid *opaque)
  158. {
  159. return(((QPAKfileinfo *) opaque)->curPos);
  160. } /* QPAK_tell */
  161. static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset)
  162. {
  163. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  164. QPAKentry *entry = finfo->entry;
  165. int rc;
  166. BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
  167. BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
  168. rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
  169. if (rc)
  170. finfo->curPos = (PHYSFS_uint32) offset;
  171. return(rc);
  172. } /* QPAK_seek */
  173. static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque)
  174. {
  175. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  176. return((PHYSFS_sint64) finfo->entry->size);
  177. } /* QPAK_fileLength */
  178. static int QPAK_fileClose(fvoid *opaque)
  179. {
  180. QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
  181. BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
  182. free(finfo);
  183. return(1);
  184. } /* QPAK_fileClose */
  185. static int qpak_open(const char *filename, int forWriting,
  186. void **fh, PHYSFS_uint32 *count)
  187. {
  188. PHYSFS_uint32 buf;
  189. *fh = NULL;
  190. BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
  191. *fh = __PHYSFS_platformOpenRead(filename);
  192. BAIL_IF_MACRO(*fh == NULL, NULL, 0);
  193. if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
  194. goto openQpak_failed;
  195. buf = PHYSFS_swapULE32(buf);
  196. if (buf != QPAK_SIGNATURE)
  197. {
  198. __PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
  199. goto openQpak_failed;
  200. } /* if */
  201. if (__PHYSFS_platformRead(*fh, &buf, sizeof (PHYSFS_uint32), 1) != 1)
  202. goto openQpak_failed;
  203. buf = PHYSFS_swapULE32(buf); /* directory table offset. */
  204. if (__PHYSFS_platformRead(*fh, count, sizeof (PHYSFS_uint32), 1) != 1)
  205. goto openQpak_failed;
  206. *count = PHYSFS_swapULE32(*count);
  207. if ((*count % 64) != 0) /* corrupted archive? */
  208. {
  209. __PHYSFS_setError(ERR_CORRUPTED);
  210. goto openQpak_failed;
  211. } /* if */
  212. if (!__PHYSFS_platformSeek(*fh, buf))
  213. goto openQpak_failed;
  214. *count /= 64;
  215. return(1);
  216. openQpak_failed:
  217. if (*fh != NULL)
  218. __PHYSFS_platformClose(*fh);
  219. *count = -1;
  220. *fh = NULL;
  221. return(0);
  222. } /* qpak_open */
  223. static int QPAK_isArchive(const char *filename, int forWriting)
  224. {
  225. void *fh;
  226. PHYSFS_uint32 fileCount;
  227. int retval = qpak_open(filename, forWriting, &fh, &fileCount);
  228. if (fh != NULL)
  229. __PHYSFS_platformClose(fh);
  230. return(retval);
  231. } /* QPAK_isArchive */
  232. static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
  233. {
  234. QPAKentry *a = (QPAKentry *) _a;
  235. return(QPAK_strcmp(a[one].name, a[two].name));
  236. } /* qpak_entry_cmp */
  237. static void qpak_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
  238. {
  239. QPAKentry tmp;
  240. QPAKentry *first = &(((QPAKentry *) _a)[one]);
  241. QPAKentry *second = &(((QPAKentry *) _a)[two]);
  242. memcpy(&tmp, first, sizeof (QPAKentry));
  243. memcpy(first, second, sizeof (QPAKentry));
  244. memcpy(second, &tmp, sizeof (QPAKentry));
  245. } /* qpak_entry_swap */
  246. static int qpak_load_entries(const char *name, int forWriting, QPAKinfo *info)
  247. {
  248. void *fh = NULL;
  249. PHYSFS_uint32 fileCount;
  250. QPAKentry *entry;
  251. BAIL_IF_MACRO(!qpak_open(name, forWriting, &fh, &fileCount), NULL, 0);
  252. info->entryCount = fileCount;
  253. info->entries = (QPAKentry *) malloc(sizeof (QPAKentry) * fileCount);
  254. if (info->entries == NULL)
  255. {
  256. __PHYSFS_platformClose(fh);
  257. BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
  258. } /* if */
  259. for (entry = info->entries; fileCount > 0; fileCount--, entry++)
  260. {
  261. PHYSFS_uint32 loc;
  262. if (__PHYSFS_platformRead(fh,&entry->name,sizeof(entry->name),1) != 1)
  263. {
  264. __PHYSFS_platformClose(fh);
  265. return(0);
  266. } /* if */
  267. if (__PHYSFS_platformRead(fh,&loc,sizeof(loc),1) != 1)
  268. {
  269. __PHYSFS_platformClose(fh);
  270. return(0);
  271. } /* if */
  272. if (__PHYSFS_platformRead(fh,&entry->size,sizeof(entry->size),1) != 1)
  273. {
  274. __PHYSFS_platformClose(fh);
  275. return(0);
  276. } /* if */
  277. entry->size = PHYSFS_swapULE32(entry->size);
  278. entry->startPos = PHYSFS_swapULE32(loc);
  279. } /* for */
  280. __PHYSFS_platformClose(fh);
  281. __PHYSFS_sort(info->entries, info->entryCount,
  282. qpak_entry_cmp, qpak_entry_swap);
  283. return(1);
  284. } /* qpak_load_entries */
  285. static void *QPAK_openArchive(const char *name, int forWriting)
  286. {
  287. QPAKinfo *info = malloc(sizeof (QPAKinfo));
  288. PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
  289. BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
  290. memset(info, '\0', sizeof (QPAKinfo));
  291. info->filename = (char *) malloc(strlen(name) + 1);
  292. if (info->filename == NULL)
  293. {
  294. __PHYSFS_setError(ERR_OUT_OF_MEMORY);
  295. goto QPAK_openArchive_failed;
  296. } /* if */
  297. if (!qpak_load_entries(name, forWriting, info))
  298. goto QPAK_openArchive_failed;
  299. strcpy(info->filename, name);
  300. info->last_mod_time = modtime;
  301. return(info);
  302. QPAK_openArchive_failed:
  303. if (info != NULL)
  304. {
  305. if (info->filename != NULL)
  306. free(info->filename);
  307. if (info->entries != NULL)
  308. free(info->entries);
  309. free(info);
  310. } /* if */
  311. return(NULL);
  312. } /* QPAK_openArchive */
  313. static PHYSFS_sint32 qpak_find_start_of_dir(QPAKinfo *info, const char *path,
  314. int stop_on_first_find)
  315. {
  316. PHYSFS_sint32 lo = 0;
  317. PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
  318. PHYSFS_sint32 middle;
  319. PHYSFS_uint32 dlen = strlen(path);
  320. PHYSFS_sint32 retval = -1;
  321. const char *name;
  322. int rc;
  323. if (*path == '\0') /* root dir? */
  324. return(0);
  325. if ((dlen > 0) && (path[dlen - 1] == '/')) /* ignore trailing slash. */
  326. dlen--;
  327. while (lo <= hi)
  328. {
  329. middle = lo + ((hi - lo) / 2);
  330. name = info->entries[middle].name;
  331. rc = QPAK_strncmp(path, name, dlen);
  332. if (rc == 0)
  333. {
  334. char ch = name[dlen];
  335. if (ch < '/') /* make sure this isn't just a substr match. */
  336. rc = -1;
  337. else if (ch > '/')
  338. rc = 1;
  339. else
  340. {
  341. if (stop_on_first_find) /* Just checking dir's existance? */
  342. return(middle);
  343. if (name[dlen + 1] == '\0') /* Skip initial dir entry. */
  344. return(middle + 1);
  345. /* there might be more entries earlier in the list. */
  346. retval = middle;
  347. hi = middle - 1;
  348. } /* else */
  349. } /* if */
  350. if (rc > 0)
  351. lo = middle + 1;
  352. else
  353. hi = middle - 1;
  354. } /* while */
  355. return(retval);
  356. } /* qpak_find_start_of_dir */
  357. static LinkedStringList *QPAK_enumerateFiles(dvoid *opaque,
  358. const char *dirname,
  359. int omitSymLinks)
  360. {
  361. QPAKinfo *info = ((QPAKinfo *) opaque);
  362. LinkedStringList *retval = NULL, *p = NULL;
  363. PHYSFS_sint32 dlen, dlen_inc, max, i;
  364. i = qpak_find_start_of_dir(info, dirname, 0);
  365. BAIL_IF_MACRO(i == -1, ERR_NO_SUCH_FILE, NULL);
  366. dlen = strlen(dirname);
  367. if ((dlen > 0) && (dirname[dlen - 1] == '/')) /* ignore trailing slash. */
  368. dlen--;
  369. dlen_inc = ((dlen > 0) ? 1 : 0) + dlen;
  370. max = (PHYSFS_sint32) info->entryCount;
  371. while (i < max)
  372. {
  373. char *add;
  374. char *ptr;
  375. PHYSFS_sint32 ln;
  376. char *e = info->entries[i].name;
  377. if ((dlen) && ((QPAK_strncmp(e, dirname, dlen)) || (e[dlen] != '/')))
  378. break; /* past end of this dir; we're done. */
  379. add = e + dlen_inc;
  380. ptr = strchr(add, '/');
  381. ln = (PHYSFS_sint32) ((ptr) ? ptr-add : strlen(add));
  382. retval = __PHYSFS_addToLinkedStringList(retval, &p, add, ln);
  383. ln += dlen_inc; /* point past entry to children... */
  384. /* increment counter and skip children of subdirs... */
  385. while ((++i < max) && (ptr != NULL))
  386. {
  387. char *e_new = info->entries[i].name;
  388. if ((QPAK_strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
  389. break;
  390. } /* while */
  391. } /* while */
  392. return(retval);
  393. } /* QPAK_enumerateFiles */
  394. /*
  395. * This will find the QPAKentry associated with a path in platform-independent
  396. * notation. Directories don't have QPAKentries associated with them, but
  397. * (*isDir) will be set to non-zero if a dir was hit.
  398. */
  399. static QPAKentry *qpak_find_entry(QPAKinfo *info, const char *path, int *isDir)
  400. {
  401. QPAKentry *a = info->entries;
  402. PHYSFS_sint32 pathlen = strlen(path);
  403. PHYSFS_sint32 lo = 0;
  404. PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
  405. PHYSFS_sint32 middle;
  406. const char *thispath = NULL;
  407. int rc;
  408. while (lo <= hi)
  409. {
  410. middle = lo + ((hi - lo) / 2);
  411. thispath = a[middle].name;
  412. rc = QPAK_strncmp(path, thispath, pathlen);
  413. if (rc > 0)
  414. lo = middle + 1;
  415. else if (rc < 0)
  416. hi = middle - 1;
  417. else /* substring match...might be dir or entry or nothing. */
  418. {
  419. if (isDir != NULL)
  420. {
  421. *isDir = (thispath[pathlen] == '/');
  422. if (*isDir)
  423. return(NULL);
  424. } /* if */
  425. if (thispath[pathlen] == '\0') /* found entry? */
  426. return(&a[middle]);
  427. else
  428. hi = middle - 1; /* adjust search params, try again. */
  429. } /* if */
  430. } /* while */
  431. if (isDir != NULL)
  432. *isDir = 0;
  433. BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
  434. } /* qpak_find_entry */
  435. static int QPAK_exists(dvoid *opaque, const char *name)
  436. {
  437. int isDir;
  438. QPAKinfo *info = (QPAKinfo *) opaque;
  439. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  440. return((entry != NULL) || (isDir));
  441. } /* QPAK_exists */
  442. static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists)
  443. {
  444. QPAKinfo *info = (QPAKinfo *) opaque;
  445. int isDir;
  446. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  447. *fileExists = ((isDir) || (entry != NULL));
  448. if (isDir)
  449. return(1); /* definitely a dir. */
  450. BAIL_MACRO(ERR_NO_SUCH_FILE, 0);
  451. } /* QPAK_isDirectory */
  452. static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists)
  453. {
  454. *fileExists = QPAK_exists(opaque, name);
  455. return(0); /* never symlinks in a quake pak. */
  456. } /* QPAK_isSymLink */
  457. static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque,
  458. const char *name,
  459. int *fileExists)
  460. {
  461. int isDir;
  462. QPAKinfo *info = ((QPAKinfo *) opaque);
  463. PHYSFS_sint64 retval = -1;
  464. QPAKentry *entry = qpak_find_entry(info, name, &isDir);
  465. *fileExists = ((isDir) || (entry != NULL));
  466. if (*fileExists) /* use time of QPAK itself in the physical filesystem. */
  467. retval = info->last_mod_time;
  468. return(retval);
  469. } /* QPAK_getLastModTime */
  470. static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
  471. {
  472. QPAKinfo *info = ((QPAKinfo *) opaque);
  473. QPAKfileinfo *finfo;
  474. QPAKentry *entry;
  475. int isDir;
  476. entry = qpak_find_entry(info, fnm, &isDir);
  477. *fileExists = ((entry != NULL) || (isDir));
  478. BAIL_IF_MACRO(isDir, ERR_NOT_A_FILE, NULL);
  479. BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
  480. finfo = (QPAKfileinfo *) malloc(sizeof (QPAKfileinfo));
  481. BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
  482. finfo->handle = __PHYSFS_platformOpenRead(info->filename);
  483. if ( (finfo->handle == NULL) ||
  484. (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
  485. {
  486. free(finfo);
  487. return(NULL);
  488. } /* if */
  489. finfo->curPos = 0;
  490. finfo->entry = entry;
  491. return(finfo);
  492. } /* QPAK_openRead */
  493. static fvoid *QPAK_openWrite(dvoid *opaque, const char *name)
  494. {
  495. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  496. } /* QPAK_openWrite */
  497. static fvoid *QPAK_openAppend(dvoid *opaque, const char *name)
  498. {
  499. BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
  500. } /* QPAK_openAppend */
  501. static int QPAK_remove(dvoid *opaque, const char *name)
  502. {
  503. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  504. } /* QPAK_remove */
  505. static int QPAK_mkdir(dvoid *opaque, const char *name)
  506. {
  507. BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
  508. } /* QPAK_mkdir */
  509. #endif /* defined PHYSFS_SUPPORTS_QPAK */
  510. /* end of qpak.c ... */