workaround for bug #6529, don't read the first buffer until at least 4 bytes are available, otherwise the image decoder library can't tell what kind of image it is. this is a blatant hack.

This commit is contained in:
beard%netscape.com 1999-05-31 02:33:31 +00:00
Родитель 469669450c
Коммит 28c1747a2f
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -195,7 +195,7 @@ ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRUint32
NS_RELEASE(reader);
return NS_ERROR_ABORT;
}
nsresult err = 0;
PRUint32 nb;
do {
@ -206,6 +206,10 @@ ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRUint32
if (max_read > IMAGE_BUF_SIZE) {
max_read = IMAGE_BUF_SIZE;
}
// make sure there's enough data available to decode the image.
if (mFirstRead && length < 4)
break;
err = pIStream->Read(mBuffer,
max_read, &nb);