Fix handling of .zips files

This commit is contained in:
Abs62 2017-04-27 18:02:44 +03:00
parent d9e6c812fc
commit 9beaf862e8
2 changed files with 18 additions and 3 deletions

View file

@ -60,6 +60,9 @@ bool SplitFile::open( QFile::OpenMode mode )
bool SplitFile::seek( quint64 pos ) bool SplitFile::seek( quint64 pos )
{ {
if( offsets.isEmpty() )
return false;
int fileNom; int fileNom;
for( fileNom = 0; fileNom < offsets.size() - 1; fileNom++ ) for( fileNom = 0; fileNom < offsets.size() - 1; fileNom++ )
@ -74,6 +77,9 @@ bool SplitFile::seek( quint64 pos )
qint64 SplitFile::read( char *data, qint64 maxSize ) qint64 SplitFile::read( char *data, qint64 maxSize )
{ {
if( offsets.isEmpty() )
return 0;
quint64 bytesReaded = 0; quint64 bytesReaded = 0;
for( int i = currentFile; i < files.size(); i++ ) for( int i = currentFile; i < files.size(); i++ )
{ {
@ -117,7 +123,7 @@ bool SplitFile::getChar( char *c )
qint64 SplitFile::pos() const qint64 SplitFile::pos() const
{ {
if( files.isEmpty() ) if( offsets.isEmpty() )
return 0; return 0;
return offsets.at( currentFile ) + files.at( currentFile )->pos(); return offsets.at( currentFile ) + files.at( currentFile )->pos();

View file

@ -200,8 +200,17 @@ SplitZipFile::SplitZipFile( const QString & name )
void SplitZipFile::setFileName( const QString & name ) void SplitZipFile::setFileName( const QString & name )
{ {
if( !name.toLower().endsWith( ".zip" ) ) {
QString lname = name.toLower();
if( lname.endsWith( ".zips" ) )
{
appendFile( name );
return; return;
}
if( !lname.endsWith( ".zip" ) )
return;
}
if( QFileInfo( name ).isFile() ) if( QFileInfo( name ).isFile() )
{ {