handle bzip2 errors

SVN revision: 13920
This commit is contained in:
Tilman Sauerbeck 2005-03-26 13:13:51 +00:00
parent 604ae99890
commit bb949f0dad
1 changed files with 8 additions and 3 deletions

View File

@ -21,7 +21,7 @@ static int uncompress_file (FILE *fp, int dest)
{
BZFILE *bf;
DATA8 outbuf[OUTBUF_SIZE];
int bytes, error;
int bytes, error, ret = 1;
bf = BZ2_bzReadOpen (&error, fp, 0, 0, NULL, 0);
@ -35,13 +35,18 @@ static int uncompress_file (FILE *fp, int dest)
if (error == BZ_OK || error == BZ_STREAM_END)
write (dest, outbuf, bytes);
else
if (error == BZ_STREAM_END)
break;
else if (error != BZ_OK) {
ret = 0;
break;
}
}
BZ2_bzReadClose (&error, bf);
return 1;
return ret;
}
char load (ImlibImage *im, ImlibProgressFunction progress,