mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Fix handling of .zips files
This commit is contained in:
parent
d9e6c812fc
commit
9beaf862e8
|
@ -60,6 +60,9 @@ bool SplitFile::open( QFile::OpenMode mode )
|
|||
|
||||
bool SplitFile::seek( quint64 pos )
|
||||
{
|
||||
if( offsets.isEmpty() )
|
||||
return false;
|
||||
|
||||
int 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 )
|
||||
{
|
||||
if( offsets.isEmpty() )
|
||||
return 0;
|
||||
|
||||
quint64 bytesReaded = 0;
|
||||
for( int i = currentFile; i < files.size(); i++ )
|
||||
{
|
||||
|
@ -117,7 +123,7 @@ bool SplitFile::getChar( char *c )
|
|||
|
||||
qint64 SplitFile::pos() const
|
||||
{
|
||||
if( files.isEmpty() )
|
||||
if( offsets.isEmpty() )
|
||||
return 0;
|
||||
|
||||
return offsets.at( currentFile ) + files.at( currentFile )->pos();
|
||||
|
|
13
zipfile.cc
13
zipfile.cc
|
@ -200,8 +200,17 @@ SplitZipFile::SplitZipFile( const QString & name )
|
|||
|
||||
void SplitZipFile::setFileName( const QString & name )
|
||||
{
|
||||
if( !name.toLower().endsWith( ".zip" ) )
|
||||
return;
|
||||
{
|
||||
QString lname = name.toLower();
|
||||
if( lname.endsWith( ".zips" ) )
|
||||
{
|
||||
appendFile( name );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !lname.endsWith( ".zip" ) )
|
||||
return;
|
||||
}
|
||||
|
||||
if( QFileInfo( name ).isFile() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue