From 89e16d0fae9dfd2cbca3460c476d4fa4c3ca2b1d Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Fri, 1 Oct 1999 02:37:31 +0000 Subject: [PATCH] Bug 13997, Reviewed by Gagan. This changes are to correctly return the number of bytes read by nsHTTPEncodeStream. git-svn-id: svn://10.0.0.236/trunk@49523 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/protocol/http/src/nsHTTPEncodeStream.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPEncodeStream.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPEncodeStream.cpp index e59f897c308..e32817688d1 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPEncodeStream.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPEncodeStream.cpp @@ -98,6 +98,7 @@ nsHTTPEncodeStream::GetData(char* buf, PRUint32 bufLen, PRUint32 *readCount) if (bufLen > 0) { // get more from the input stream rv = mInput->Read(buf, bufLen, &amt); + *readCount += amt; } return rv; } @@ -116,10 +117,13 @@ nsHTTPEncodeStream::Read(char* outBuf, PRUint32 outBufCnt, PRUint32 *result) #define BUF_SIZE 1024 char readBuf[BUF_SIZE]; PRUint32 amt = 0; + PRUint32 bytesRead = 0; while (outBufCnt > 0) { PRUint32 readCnt = PR_MIN(outBufCnt, BUF_SIZE); rv = GetData(readBuf, readCnt, &amt); + bytesRead += amt; + *result = bytesRead; if (NS_FAILED(rv)) return rv; if (rv == NS_BASE_STREAM_WOULD_BLOCK || amt == 0) return rv;