ZIPS: Change handling of UTF-8 encoded file names

This commit is contained in:
Abs62 2014-10-09 23:30:11 +04:00
parent eac157af29
commit 6238f33d1f
4 changed files with 29 additions and 24 deletions

View file

@ -187,6 +187,8 @@ bool IndexedZip::indexFile( BtreeIndexing::IndexedWords &zipFileNames )
// Failed to decode
}
if( !entry.fileNameInUTF8 )
{
// CP866
try
{
@ -216,5 +218,6 @@ bool IndexedZip::indexFile( BtreeIndexing::IndexedWords &zipFileNames )
}
}
}
}
return true;
}

View file

@ -151,6 +151,7 @@ bool readNextEntry( QFile & zip, CentralDirEntry & entry )
entry.compressedSize = qFromLittleEndian( record.compressedSize );
entry.uncompressedSize = qFromLittleEndian( record.uncompressedSize );
entry.compressionMethod = getCompressionMethod( record.compressionMethod );
entry.fileNameInUTF8 = ( qFromLittleEndian( record.gpBits ) & 0x800 ) != 0;
return true;
}

View file

@ -24,6 +24,7 @@ struct CentralDirEntry
quint32 localHeaderOffset, compressedSize, uncompressedSize;
CompressionMethod compressionMethod;
bool fileNameInUTF8;
};
/// Represents contents of the local file header -- that what CentralDirEntry::

View file

@ -44,7 +44,7 @@ DEF_EX( exInvalidData, "Invalid data encountered", Dictionary::Ex )
enum
{
Signature = 0x5350495a, // ZIPS on little-endian, SPIZ on big-endian
CurrentFormatVersion = 3 + BtreeIndexing::FormatVersion
CurrentFormatVersion = 4 + BtreeIndexing::FormatVersion
};
struct IdxHeader