From 1cd737653eaa4bda8f28bca0491ddb9956936590 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Wed, 19 Jan 2005 19:44:37 +0000 Subject: [PATCH] Bug 278786 Scriptable inputstream needs not call available in Read r+sr=darin --- xpcom/io/nsScriptableInputStream.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/xpcom/io/nsScriptableInputStream.cpp b/xpcom/io/nsScriptableInputStream.cpp index 5458b1b77d84..cb68dfd3bdd5 100644 --- a/xpcom/io/nsScriptableInputStream.cpp +++ b/xpcom/io/nsScriptableInputStream.cpp @@ -64,20 +64,15 @@ nsScriptableInputStream::Available(PRUint32 *_retval) { NS_IMETHODIMP nsScriptableInputStream::Read(PRUint32 aCount, char **_retval) { nsresult rv = NS_OK; - PRUint32 count = 0; char *buffer = nsnull; if (!mInputStream) return NS_ERROR_NOT_INITIALIZED; - rv = mInputStream->Available(&count); - if (NS_FAILED(rv)) return rv; - - count = PR_MIN(count, aCount); - buffer = (char*)nsMemory::Alloc(count+1); // make room for '\0' + buffer = (char*)nsMemory::Alloc(aCount+1); // make room for '\0' if (!buffer) return NS_ERROR_OUT_OF_MEMORY; PRUint32 amtRead = 0; - rv = mInputStream->Read(buffer, count, &amtRead); + rv = mInputStream->Read(buffer, aCount, &amtRead); if (NS_FAILED(rv)) { nsMemory::Free(buffer); return rv;