Skip to content

Latest commit

 

History

History
732 lines (557 loc) · 18.2 KB

qpak.c

File metadata and controls

732 lines (557 loc) · 18.2 KB
 
Aug 9, 2002
Aug 9, 2002
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* Quake PAK support routines for PhysicsFS.
*
* This driver handles id Software Quake PAK files.
*
* Please see the file LICENSE in the source's root directory.
*
* This file written by Ed Sinjiashvili.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if (defined PHYSFS_SUPPORTS_QPAK)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h"
#define QPAK_MAXDIRLEN 60
typedef struct
{
char name[56];
PHYSFS_uint32 offset;
PHYSFS_uint32 size;
} QPAKentry;
typedef struct tagQPAKdirentry
{
char *name;
QPAKentry *entry;
struct tagQPAKdirentry *next;
} QPAKdirentry;
typedef struct QPAKDirectory
{
char name[QPAK_MAXDIRLEN];
struct QPAKDirectory *dirs, *next;
QPAKdirentry *files;
} QPAKdirectory;
typedef struct
{
void *handle;
char *filename;
PHYSFS_uint32 dirOffset;
PHYSFS_uint32 totalEntries;
QPAKentry *entries;
QPAKdirectory *root;
} QPAKinfo;
typedef struct
{
void *handle;
QPAKentry *entry;
PHYSFS_sint64 curPos;
} QPAKfileinfo;
static int QPAK_isArchive(const char *filename, int forWriting);
static DirHandle *QPAK_openArchive(const char *name, int forWriting);
static void QPAK_dirClose(DirHandle *h);
static LinkedStringList *QPAK_enumerateFiles(DirHandle *h, const char *dirname,
int omitSymLinks);
static int QPAK_exists(DirHandle *h, const char *name);
static int QPAK_isDirectory(DirHandle *h, const char *name);
static int QPAK_isSymLink(DirHandle *h, const char *name);
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h, const char *name);
static FileHandle *QPAK_openRead(DirHandle *h, const char *name);
static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
static int QPAK_eof(FileHandle *handle);
static PHYSFS_sint64 QPAK_tell(FileHandle *handle);
static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset);
static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle);
static int QPAK_fileClose(FileHandle *handle);
const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK =
{
"PAK",
"Quake PAK file format",
"Ed Sinjiashvili <slimb@swes.saren.ru>",
"http://icculus.org/physfs/",
};
static const FileFunctions __PHYSFS_FileFunctions_QPAK =
{
QPAK_read, /* read() method */
NULL, /* write() method */
QPAK_eof, /* eof() method */
QPAK_tell, /* tell() method */
QPAK_seek, /* seek() method */
QPAK_fileLength, /* fileLength() method */
QPAK_fileClose /* fileClose() method */
};
const DirFunctions __PHYSFS_DirFunctions_QPAK =
{
&__PHYSFS_ArchiveInfo_QPAK,
QPAK_isArchive, /* isArchive() method */
QPAK_openArchive, /* openArchive() method */
QPAK_enumerateFiles, /* enumerateFiles() method */
QPAK_exists, /* exists() method */
QPAK_isDirectory, /* isDirectory() method */
QPAK_isSymLink, /* isSymLink() method */
QPAK_getLastModTime, /* getLastModTime() method */
QPAK_openRead, /* openRead() method */
NULL, /* openWrite() method */
NULL, /* openAppend() method */
NULL, /* remove() method */
NULL, /* mkdir() method */
QPAK_dirClose /* dirClose() method */
};
#define QPAK_MAGIC 0x4B434150 /* look like "PACK" in ascii. */
/*
* Read an unsigned 32-bit int and swap to native byte order.
*/
static int readui32(void *in, PHYSFS_uint32 *val)
{
PHYSFS_uint32 v;
BAIL_IF_MACRO(__PHYSFS_platformRead(in, &v, sizeof (v), 1) != 1, NULL, 0);
*val = PHYSFS_swapULE32(v);
return(1);
} /* readui32 */
static int openQPak(const char *filename, int forWriting, void **fileHandle)
{
PHYSFS_uint32 sig;
*fileHandle = NULL;
BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
*fileHandle = __PHYSFS_platformOpenRead(filename);
BAIL_IF_MACRO(*fileHandle == NULL, NULL, 0);
if (!readui32(*fileHandle, &sig))
goto openPak_failed;
Aug 16, 2002
Aug 16, 2002
157
if (sig != QPAK_MAGIC)
Aug 9, 2002
Aug 9, 2002
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
{
__PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
goto openPak_failed;
} /* if */
return(1);
openPak_failed:
if (*fileHandle != NULL)
__PHYSFS_platformClose(*fileHandle);
*fileHandle = NULL;
return(0);
} /* openQPak */
static int QPAK_isArchive(const char *filename, int forWriting)
{
void *fileHandle;
int retval = openQPak(filename, forWriting, &fileHandle);
if (fileHandle != NULL)
__PHYSFS_platformClose(fileHandle);
return(retval);
} /* QPAK_isArchive */
static int qpak_loadEntries(void *fh, int dirOffset, int numEntries,
QPAKentry *entries)
{
PHYSFS_uint32 i;
BAIL_IF_MACRO(__PHYSFS_platformSeek(fh, dirOffset) == 0, NULL, 0);
for (i = 0; i < numEntries; i++, entries++)
{
PHYSFS_sint64 r = __PHYSFS_platformRead(fh, entries->name, 56, 1);
BAIL_IF_MACRO(r == 0, NULL, 0);
BAIL_IF_MACRO(!readui32(fh, &entries->offset), NULL, 0);
BAIL_IF_MACRO(!readui32(fh, &entries->size), NULL, 0);
} /* for */
return(1);
} /* qpak_loadEntries */
static QPAKdirentry *qpak_newDirentry(char *name, QPAKentry *entry)
{
QPAKdirentry *retval = (QPAKdirentry *) malloc(sizeof (QPAKdirentry));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, 0);
retval->name = name;
retval->entry = entry;
retval->next = NULL;
return(retval);
} /* qpak_newDirentry */
static void qpak_deleteDirentry(QPAKdirentry *e)
{
while (e != NULL)
{
QPAKdirentry *next = e->next;
free(e);
e = next;
} /* while */
} /* qpak_deleteDirentry */
static QPAKdirectory *qpak_newDirectory(char *name)
{
QPAKdirectory *dir = (QPAKdirectory *) malloc(sizeof (QPAKdirectory));
BAIL_IF_MACRO(dir == NULL, ERR_OUT_OF_MEMORY, 0);
strcpy(dir->name, name);
dir->dirs = NULL;
dir->next = NULL;
dir->files = NULL;
return dir;
} /* qpak_newDirectory */
static void qpak_deleteDirectory(QPAKdirectory *d)
{
while (d != NULL)
{
QPAKdirectory *next = d->next;
qpak_deleteDirentry(d->files);
qpak_deleteDirectory(d->dirs);
free(d);
d = next;
} /* while */
} /* qpak_deleteDirectory */
static int qpak_addFile(QPAKdirectory *dir, char *name, QPAKentry *entry)
{
QPAKdirentry *file = qpak_newDirentry(name, entry);
if (file == NULL)
return(0);
/* !!! FIXME: Traversing a linkedlist gets slower with each added file. */
if (dir->files == NULL)
{
dir->files = file;
} /* if */
else
{
QPAKdirentry *tail = dir->files;
while (tail->next != NULL)
tail = tail->next;
tail->next = file;
} /* else */
return(1);
} /* qpak_addFile */
static QPAKdirectory *qpak_findDirectory(QPAKdirectory *root, const char *name)
{
char *p = strchr(name, '/');
if (p == NULL)
{
QPAKdirectory *thisDir = root->dirs;
while (thisDir != NULL)
{
if (strcmp(thisDir->name, name) == 0)
return(thisDir);
thisDir = thisDir->next;
} /* while */
} /* if */
else
{
char temp[QPAK_MAXDIRLEN];
QPAKdirectory *thisDir = root->dirs;
strncpy (temp, name, p - name);
temp[p - name] = '\0';
while (thisDir != NULL)
{
if (strcmp(thisDir->name, temp) == 0)
return(qpak_findDirectory(thisDir, p + 1));
thisDir = thisDir->next;
} /* while */
} /* else */
return(0);
} /* qpak_findDirectory */
static QPAKdirectory *qpak_addDir(QPAKdirectory *dir, char *name)
{
QPAKdirectory *newDir = qpak_findDirectory(dir, name);
if (newDir != 0)
return(newDir);
newDir = qpak_newDirectory(name);
if (newDir == 0)
return 0;
if (dir->dirs == NULL)
{
dir->dirs = newDir;
} /* if */
else
{
QPAKdirectory *tail = dir->dirs;
while (tail->next != NULL)
tail = tail->next;
tail->next = newDir;
} /* else */
return(newDir);
} /* qpak_addDir */
static int qpak_addEntry(QPAKdirectory *dir, char *name, QPAKentry *entry)
{
char tempName[QPAK_MAXDIRLEN];
QPAKdirectory *child;
char *p = strchr(name, '/');
if (p == NULL)
return(qpak_addFile(dir, name, entry));
strncpy(tempName, name, p - name);
tempName[p - name] = '\0';
child = qpak_addDir(dir, tempName);
return(qpak_addEntry(child, p + 1, entry));
} /* qpak_addEntry */
static QPAKentry *qpak_findEntry(QPAKdirectory *root, const char *name)
{
QPAKdirectory *dir = NULL;
QPAKdirentry *thisFile = NULL;
const char *t = strrchr (name, '/');
if (t == NULL)
{
dir = root;
t = name;
} /* if */
else
{
char temp[QPAK_MAXDIRLEN];
strncpy(temp, name, t - name);
temp[t - name] = '\0';
dir = qpak_findDirectory(root, temp);
t++;
} /* else */
if (dir == NULL)
return(0);
thisFile = dir->files;
while (thisFile != NULL)
{
if (strcmp(thisFile->name, t) == 0)
return(thisFile->entry);
thisFile = thisFile->next;
} /* while */
return(0);
} /* qpak_findEntry */
static int qpak_populateDirectories(QPAKentry *entries, int numEntries,
QPAKdirectory *root)
{
PHYSFS_uint32 i;
QPAKentry *entry = entries;
for (i = 0; i < numEntries; i++, entry++)
{
if (qpak_addEntry(root, entry->name, entry) == 0)
return(0);
} /* for */
return(1);
} /* qpak_populateDirectories */
Aug 20, 2002
Aug 20, 2002
413
static void qpak_deletePakInfo(QPAKinfo *pakInfo)
Aug 9, 2002
Aug 9, 2002
414
{
Aug 16, 2002
Aug 16, 2002
415
416
417
if (pakInfo->handle != NULL)
__PHYSFS_platformClose(pakInfo->handle);
Aug 9, 2002
Aug 9, 2002
418
419
420
421
422
423
424
425
426
427
428
429
if (pakInfo->filename != NULL)
free(pakInfo->filename);
if (pakInfo->entries != NULL)
free(pakInfo->entries);
qpak_deleteDirectory(pakInfo->root);
free(pakInfo);
} /* qpak_deletePakInfo */
Aug 20, 2002
Aug 20, 2002
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry *a = (QPAKentry *) _a;
return(strcmp(a[one].name, a[two].name));
} /* qpak_entry_cmp */
static void qpak_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
{
QPAKentry tmp;
QPAKentry *first = &(((QPAKentry *) _a)[one]);
QPAKentry *second = &(((QPAKentry *) _a)[two]);
memcpy(&tmp, first, sizeof (QPAKentry));
memcpy(first, second, sizeof (QPAKentry));
memcpy(second, &tmp, sizeof (QPAKentry));
} /* qpak_entry_swap */
Aug 9, 2002
Aug 9, 2002
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
static DirHandle *QPAK_openArchive(const char *name, int forWriting)
{
void *fh = NULL;
PHYSFS_uint32 dirOffset, dirLength;
QPAKinfo *pi;
DirHandle *retval;
retval = (DirHandle *) malloc(sizeof (DirHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
pi = (QPAKinfo *) malloc(sizeof (QPAKinfo));
if (pi == NULL)
{
free(retval);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
retval->opaque = pi;
pi->filename = (char *) malloc(strlen(name) + 1);
if (pi->filename == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
if (!openQPak(name, forWriting, &fh))
goto QPAK_openArchive_failed;
if (!readui32(fh, &dirOffset))
goto QPAK_openArchive_failed;
if (!readui32(fh, &dirLength))
goto QPAK_openArchive_failed;
if (__PHYSFS_platformFileLength(fh) < dirOffset + dirLength)
goto QPAK_openArchive_failed;
strcpy(pi->filename, name);
pi->handle = fh;
pi->dirOffset = dirOffset;
pi->totalEntries = dirLength / 64;
pi->entries = (QPAKentry *) malloc(pi->totalEntries * sizeof (QPAKentry));
if (pi->entries == NULL)
{
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
goto QPAK_openArchive_failed;
} /* if */
if (qpak_loadEntries(fh, dirOffset, pi->totalEntries, pi->entries) == 0)
goto QPAK_openArchive_failed;
Aug 20, 2002
Aug 20, 2002
501
502
__PHYSFS_sort(pi->entries, pi->totalEntries,
qpak_entry_cmp, qpak_entry_swap);
Aug 9, 2002
Aug 9, 2002
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
pi->root = qpak_newDirectory("");
if (pi->root == NULL)
goto QPAK_openArchive_failed;
if (qpak_populateDirectories(pi->entries, pi->totalEntries, pi->root) == 0)
goto QPAK_openArchive_failed;
retval->funcs = &__PHYSFS_DirFunctions_QPAK;
return(retval);
QPAK_openArchive_failed:
if (retval != NULL)
{
if (retval->opaque != NULL)
qpak_deletePakInfo((QPAKinfo *) retval->opaque);
free(retval);
} /* if */
if (fh != NULL)
__PHYSFS_platformClose(fh);
return(0);
} /* QPAK_openArchive */
static void QPAK_dirClose(DirHandle *dirHandle)
{
Aug 16, 2002
Aug 16, 2002
532
qpak_deletePakInfo((QPAKinfo *) dirHandle->opaque);
Aug 9, 2002
Aug 9, 2002
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
free(dirHandle);
} /* QPAK_dirClose */
static LinkedStringList *QPAK_enumerateFiles(DirHandle *h, const char *dirname,
int omitSymLinks)
{
LinkedStringList *retval = NULL, *p = NULL;
QPAKdirectory *dir;
QPAKinfo *info = (QPAKinfo *) h->opaque;
if ((dirname == NULL) || (*dirname == '\0'))
dir = info->root;
else
dir = qpak_findDirectory(info->root, dirname);
if (dir != NULL)
{
QPAKdirectory *child = dir->dirs;
QPAKdirentry *file = dir->files;
while (child != NULL)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p, child->name, -1);
child = child->next;
} /* while */
while (file != NULL)
{
retval = __PHYSFS_addToLinkedStringList(retval, &p, file->name, -1);
file = file->next;
} /* while */
} /* if */
return(retval);
} /* QPAK_enumerateFiles */
static int QPAK_exists(DirHandle *h, const char *name)
{
QPAKinfo *driver = (QPAKinfo *) h->opaque;
if ((name == NULL) || (*name == '\0'))
return(0);
if (qpak_findDirectory(driver->root, name) != 0)
return(1);
if (qpak_findEntry(driver->root, name) != 0)
return(1);
return(0);
} /* QPAK_exists */
static int QPAK_isDirectory(DirHandle *h, const char *name)
{
QPAKinfo *info = (QPAKinfo *) h->opaque;
return(qpak_findDirectory(info->root, name) != 0);
} /* QPAK_isDirectory */
static int QPAK_isSymLink(DirHandle *h, const char *name)
{
return(0); /* we don't support symlinks for now */
} /* QPAK_isSymlink */
static PHYSFS_sint64 QPAK_getLastModTime(DirHandle *h, const char *name)
{
return(__PHYSFS_platformGetLastModTime(((QPAKinfo *) h->opaque)->filename));
} /* QPAK_getLastModTime */
static void *qpak_getFileHandle(const char *name, QPAKentry *entry)
{
void *retval = __PHYSFS_platformOpenRead(name);
if (retval == NULL)
return(NULL);
if (!__PHYSFS_platformSeek(retval, entry->offset))
{
__PHYSFS_platformClose(retval);
return(NULL);
} /* if */
return(retval);
} /* qpak_getFileHandle */
static FileHandle *QPAK_openRead(DirHandle *h, const char *name)
{
QPAKinfo *driver = (QPAKinfo *) h->opaque;
QPAKentry *entry = qpak_findEntry(driver->root, name);
QPAKfileinfo *fileDriver = 0;
FileHandle *result = 0;
if (entry == NULL)
return(NULL);
fileDriver = (QPAKfileinfo *) malloc(sizeof (QPAKfileinfo));
BAIL_IF_MACRO(fileDriver == NULL, ERR_OUT_OF_MEMORY, NULL);
fileDriver->handle = qpak_getFileHandle(driver->filename, entry);
if (fileDriver->handle == NULL)
{
free(fileDriver);
return(NULL);
} /* if */
fileDriver->entry = entry;
fileDriver->curPos = 0;
result = (FileHandle *)malloc(sizeof (FileHandle));
if (result == NULL)
{
__PHYSFS_platformClose(fileDriver->handle);
free(fileDriver);
BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
} /* if */
result->opaque = fileDriver;
result->dirHandle = h;
result->funcs = &__PHYSFS_FileFunctions_QPAK;
return(result);
} /* QPAK_openRead */
static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
QPAKentry *entry = finfo->entry;
PHYSFS_uint64 bytesLeft = entry->size - finfo->curPos;
PHYSFS_uint64 objsLeft = (bytesLeft / objSize);
PHYSFS_sint64 rc;
if (objsLeft < objCount)
objCount = (PHYSFS_uint32) objsLeft;
rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
if (rc > 0)
finfo->curPos += (rc * objSize);
return(rc);
} /* QPAK_read */
static int QPAK_eof(FileHandle *handle)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
QPAKentry *entry = finfo->entry;
return(finfo->curPos >= (PHYSFS_sint64) entry->size);
} /* QPAK_eof */
static PHYSFS_sint64 QPAK_tell(FileHandle *handle)
{
return(((QPAKfileinfo *) handle->opaque)->curPos);
} /* QPAK_tell */
static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) handle->opaque;
QPAKentry *entry = finfo->entry;
PHYSFS_uint64 newPos = entry->offset + offset;
int rc;
BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(newPos > entry->offset + entry->size, ERR_PAST_EOF, 0);
rc = __PHYSFS_platformSeek(finfo->handle, newPos);
if (rc)
finfo->curPos = offset;
return(rc);
} /* QPAK_seek */
static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle)
{
return ((QPAKfileinfo *) handle->opaque)->entry->size;
} /* QPAK_fileLength */
static int QPAK_fileClose(FileHandle *handle)
{
QPAKfileinfo *finfo = (QPAKfileinfo *) handle->opaque;
BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
free(finfo);
free(handle);
return(1);
} /* QPAK_fileClose */
#endif /* defined PHYSFS_SUPPORTS_QPAK */
/* end of qpak.c ... */