From b216c712418ff9260683c212e2c5a1af25bee600 Mon Sep 17 00:00:00 2001 From: thilo Date: Mon, 19 Oct 2009 14:00:16 +0000 Subject: Just unix2dos, nothing to see here ... git-svn-id: svn://svn.icculus.org/quake3/trunk@1681 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/files.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'code/qcommon/files.c') diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 1b17808..249470b 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -202,6 +202,7 @@ static const unsigned pak_checksums[] = { typedef struct fileInPack_s { char *name; // name of the file unsigned long pos; // file info position in zip + unsigned long len; // uncompress file size struct fileInPack_s* next; // next file in the hash } fileInPack_t; @@ -990,7 +991,6 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF fileInPack_t *pakFile; directory_t *dir; long hash; - unz_s *zfi; FILE *temp; int l; char demoExt[16]; @@ -1118,26 +1118,17 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF if ( uniqueFILE ) { // open a new file on the pakfile - fsh[*file].handleFiles.file.z = unzReOpen (pak->pakFilename, pak->handle); + fsh[*file].handleFiles.file.z = unzOpen (pak->pakFilename); if (fsh[*file].handleFiles.file.z == NULL) { - Com_Error (ERR_FATAL, "Couldn't reopen %s", pak->pakFilename); + Com_Error (ERR_FATAL, "Couldn't open %s", pak->pakFilename); } } else { fsh[*file].handleFiles.file.z = pak->handle; } Q_strncpyz( fsh[*file].name, filename, sizeof( fsh[*file].name ) ); fsh[*file].zipFile = qtrue; - zfi = (unz_s *)fsh[*file].handleFiles.file.z; - // in case the file was new - temp = zfi->file; // set the file position in the zip file (also sets the current file info) - unzSetCurrentFileInfoPosition(pak->handle, pakFile->pos); - if ( zfi != pak->handle ) { - // copy the file info into the unzip structure - Com_Memcpy( zfi, pak->handle, sizeof(unz_s) ); - } - // we copy this back into the structure - zfi->file = temp; + unzSetOffset(fsh[*file].handleFiles.file.z, pakFile->pos); // open the file in the zip unzOpenCurrentFile( fsh[*file].handleFiles.file.z ); fsh[*file].zipFilePos = pakFile->pos; @@ -1146,7 +1137,7 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF Com_Printf( "FS_FOpenFileRead: %s (found in '%s')\n", filename, pak->pakFilename ); } - return zfi->cur_file_info.uncompressed_size; + return pakFile->len; } pakFile = pakFile->next; } while(pakFile != NULL); @@ -1373,7 +1364,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) { switch( origin ) { case FS_SEEK_SET: - unzSetCurrentFileInfoPosition(fsh[f].handleFiles.file.z, fsh[f].zipFilePos); + unzSetOffset(fsh[f].handleFiles.file.z, fsh[f].zipFilePos); unzOpenCurrentFile(fsh[f].handleFiles.file.z); //fallthrough @@ -1753,8 +1744,8 @@ static pack_t *FS_LoadZipFile( char *zipfile, const char *basename ) strcpy( buildBuffer[i].name, filename_inzip ); namePtr += strlen(filename_inzip) + 1; // store the file position in the zip - unzGetCurrentFileInfoPosition(uf, &buildBuffer[i].pos); - // + buildBuffer[i].pos = unzGetOffset(uf); + buildBuffer[i].len = file_info.uncompressed_size; buildBuffer[i].next = pack->hashTable[hash]; pack->hashTable[hash] = &buildBuffer[i]; unzGoToNextFile(uf); -- cgit v1.2.3