From f6f5c41e1c6fac501e33721e6a78df1de0b25507 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Sun, 12 Mar 2000 22:38:41 +0000 Subject: [PATCH] Checking result of Available. --- netwerk/base/src/nsStreamLoader.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/netwerk/base/src/nsStreamLoader.cpp b/netwerk/base/src/nsStreamLoader.cpp index 61ffd4fde8b6..f39808524f86 100644 --- a/netwerk/base/src/nsStreamLoader.cpp +++ b/netwerk/base/src/nsStreamLoader.cpp @@ -123,16 +123,11 @@ nsStreamLoader::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt, char buffer[BUF_SIZE]; PRUint32 len, lenRead; - inStr->Available(&len); + rv = inStr->Available(&len); + if (NS_FAILED(rv)) return rv; while (len > 0) { - if (len < BUF_SIZE) { - lenRead = len; - } - else { - lenRead = BUF_SIZE; - } - + lenRead = PR_MIN(len, BUF_SIZE); rv = inStr->Read(buffer, lenRead, &lenRead); if (NS_FAILED(rv) || lenRead == 0) { return rv;