mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-22 03:43:58 +00:00
backing out patch for bug 278786. it breaks read(-1).
This commit is contained in:
parent
e8ace4f904
commit
bf9a5d31f9
@ -64,15 +64,20 @@ 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;
|
||||
|
||||
buffer = (char*)nsMemory::Alloc(aCount+1); // make room for '\0'
|
||||
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'
|
||||
if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUint32 amtRead = 0;
|
||||
rv = mInputStream->Read(buffer, aCount, &amtRead);
|
||||
rv = mInputStream->Read(buffer, count, &amtRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsMemory::Free(buffer);
|
||||
return rv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user