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