mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
Fix some bgl indexing error
This commit is contained in:
parent
6f5a2c16b0
commit
2b827185c1
|
@ -138,6 +138,7 @@ bool Babylon::readBlock( bgl_block &block )
|
|||
{
|
||||
free( block.data );
|
||||
block.length = 0;
|
||||
gzclearerr( file );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +154,14 @@ unsigned int Babylon::bgl_readnum( int bytes )
|
|||
|
||||
if ( bytes < 1 || bytes > 4 ) return (0);
|
||||
|
||||
gzread( file, buf, bytes );
|
||||
int res = gzread( file, buf, bytes );
|
||||
|
||||
if( res != bytes )
|
||||
{
|
||||
gzclearerr( file );
|
||||
return 4; // Read error - return end of file marker
|
||||
}
|
||||
|
||||
for(int i=0;i<bytes;i++) val= (val << 8) | buf[i];
|
||||
return val;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue