1
0
Fork 0
forked from fte/fteqw

Fixed to work on big endian.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1132 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Mark Olsen 2005-07-05 16:55:59 +00:00
parent 11cb7c2c15
commit 09d65658b4

View file

@ -133,7 +133,7 @@ local int unzlocal_getShort(FILE *fin,unsigned long *pi) {
unsigned short c; unsigned short c;
int err = fread(&c, 2, 1, fin); int err = fread(&c, 2, 1, fin);
if (err==1) { if (err==1) {
*pi = (unsigned long)c; *pi = LittleShort(c);
return UNZ_OK; return UNZ_OK;
} else { } else {
if (ferror(fin)) return UNZ_ERRNO; if (ferror(fin)) return UNZ_ERRNO;
@ -145,7 +145,7 @@ local int unzlocal_getLong(FILE *fin,unsigned long *pi) {
unsigned long c; unsigned long c;
int err = fread(&c, 4, 1, fin); int err = fread(&c, 4, 1, fin);
if (err==1) { if (err==1) {
*pi = (unsigned long)c; *pi = LittleLong(c);
return UNZ_OK; return UNZ_OK;
} else { } else {
if (ferror(fin)) return UNZ_ERRNO; if (ferror(fin)) return UNZ_ERRNO;
@ -354,6 +354,20 @@ local int unzlocal_GetCurrentFileInfoInternal (unzFile file,
} }
fread(&file_info, sizeof(file_info)-2*4, 1, s->file); // 2*4 is the size of 2 my vars fread(&file_info, sizeof(file_info)-2*4, 1, s->file); // 2*4 is the size of 2 my vars
file_info.version = LittleShort(file_info.version);
file_info.version_needed = LittleShort(file_info.version_needed);
file_info.flag = LittleShort(file_info.flag);
file_info.compression_method = LittleShort(file_info.compression_method);
file_info.dosDate = LittleLong(file_info.dosDate);
file_info.crc = LittleLong(file_info.crc);
file_info.compressed_size = LittleLong(file_info.compressed_size);
file_info.uncompressed_size = LittleLong(file_info.uncompressed_size);
file_info.size_filename = LittleShort(file_info.size_filename);
file_info.size_file_extra = LittleShort(file_info.size_file_extra);
file_info.size_file_comment = LittleShort(file_info.size_file_comment);
file_info.disk_num_start = LittleShort(file_info.disk_num_start);
file_info.internal_fa = LittleShort(file_info.internal_fa);
file_info.external_fa = LittleLong(file_info.external_fa);
if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) err=UNZ_ERRNO; if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) err=UNZ_ERRNO;