@@ -138,7 +138,6 @@ typedef struct {
138
138
139
139
//in case we're forced away.
140
140
zipfile_t * parent ;
141
- qbool iscompressed ;
142
141
int pos ;
143
142
int length ; //try and optimise some things
144
143
int index ;
@@ -181,23 +180,9 @@ static int VFSZIP_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestore
181
180
if (vfsz -> defer )
182
181
return VFS_READ (vfsz -> defer , buffer , bytestoread , err );
183
182
184
- // if (vfsz->iscompressed)
185
- // {
186
- VFSZIP_MakeActive (vfsz );
187
- read = unzReadCurrentFile (vfsz -> parent -> handle , buffer , bytestoread );
188
- // }
189
- // else
190
- // {
191
- // VFS-FIXME This stuff seems to be only for optimisation,
192
- // hence we can probably just go with unzReadCurrentFile
193
- // if (vfsz->parent->currentfile != file)
194
- // {
195
- // unzCloseCurrentFile(vfsz->parent->handle);
196
- // VFS_SEEK(vfsz->parent->raw, vfsz->pos+vfsz->startpos, SEEK_SET);
197
- // vfsz->parent->currentfile = file;
198
- // }
199
- // read = VFS_READ(vfsz->parent->raw, buffer, bytestoread, err);
200
- // }
183
+ VFSZIP_MakeActive (vfsz );
184
+ read = unzReadCurrentFile (vfsz -> parent -> handle , buffer , bytestoread );
185
+
201
186
if (err )
202
187
* err = ((read || bytestoread <= 0 ) ? VFSERR_NONE : VFSERR_EOF );
203
188
@@ -222,35 +207,32 @@ static int VFSZIP_Seek (struct vfsfile_s *file, unsigned long pos, int whence)
222
207
//This is *really* inefficient
223
208
if (vfsz -> parent -> currentfile == file )
224
209
{
225
- if (vfsz -> iscompressed )
226
- { //if they're going to seek on a file in a zip, let's just copy it out
227
- char buffer [8192 ];
228
- unsigned int chunk ;
229
- unsigned int i ;
230
- unsigned int length ;
231
-
232
- vfsz -> defer = FS_OpenTemp ();
233
- if (vfsz -> defer )
210
+ char buffer [8192 ];
211
+ unsigned int chunk ;
212
+ unsigned int i ;
213
+ unsigned int length ;
214
+
215
+ vfsz -> defer = FS_OpenTemp ();
216
+ if (vfsz -> defer )
217
+ {
218
+ unzCloseCurrentFile (vfsz -> parent -> handle );
219
+ vfsz -> parent -> currentfile = NULL ; //make it not us
220
+
221
+ length = vfsz -> length ;
222
+ i = 0 ;
223
+ vfsz -> pos = 0 ;
224
+ VFSZIP_MakeActive (vfsz );
225
+ while (1 )
234
226
{
235
- unzCloseCurrentFile (vfsz -> parent -> handle );
236
- vfsz -> parent -> currentfile = NULL ; //make it not us
237
-
238
- length = vfsz -> length ;
239
- i = 0 ;
240
- vfsz -> pos = 0 ;
241
- VFSZIP_MakeActive (vfsz );
242
- while (1 )
243
- {
244
- chunk = length - i ;
245
- if (chunk > sizeof (buffer ))
246
- chunk = sizeof (buffer );
247
- if (chunk == 0 )
248
- break ;
249
- unzReadCurrentFile (vfsz -> parent -> handle , buffer , chunk );
250
- VFS_WRITE (vfsz -> defer , buffer , chunk );
251
-
252
- i += chunk ;
253
- }
227
+ chunk = length - i ;
228
+ if (chunk > sizeof (buffer ))
229
+ chunk = sizeof (buffer );
230
+ if (chunk == 0 )
231
+ break ;
232
+ unzReadCurrentFile (vfsz -> parent -> handle , buffer , chunk );
233
+ VFS_WRITE (vfsz -> defer , buffer , chunk );
234
+
235
+ i += chunk ;
254
236
}
255
237
}
256
238
@@ -327,19 +309,6 @@ static vfsfile_t *FSZIP_OpenVFS(void *handle, flocation_t *loc, char *mode)
327
309
if (loc -> search )
328
310
vfsz -> funcs .copyprotected = loc -> search -> copyprotected ;
329
311
330
- // VFS-FIXME:
331
- // What is the point of is compressed etc
332
-
333
- //unzLocateFileMy(vfsz->parent->handle, vfsz->index, vfsz->startpos);
334
- //rawofs = unzGetCurrentFileUncompressedPos(zip->handle);
335
- /*vfsz->iscompressed = 1; // rawofs<0;
336
- if (!vfsz->iscompressed)
337
- {
338
- vfsz->startpos = rawofs;
339
- VFS_SEEK(zip->raw, vfsz->startpos, SEEK_SET);
340
- vfsz->parent->currentfile = (vfsfile_t*)vfsz;
341
- }*/
342
-
343
312
zip -> references ++ ;
344
313
345
314
return (vfsfile_t * )vfsz ;
0 commit comments