summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netwerk/base/nsSocketTransport2.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp
index b560eae6d1..3c6804760a 100644
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:set ts=4 sw=4 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -2099,7 +2098,7 @@ NS_IMETHODIMP
nsSocketTransport::OpenInputStream(uint32_t flags,
uint32_t segsize,
uint32_t segcount,
- nsIInputStream **result)
+ nsIInputStream **aResult)
{
SOCKET_LOG(("nsSocketTransport::OpenInputStream [this=%p flags=%x]\n",
this, flags));
@@ -2108,6 +2107,7 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
nsresult rv;
nsCOMPtr<nsIAsyncInputStream> pipeIn;
+ nsCOMPtr<nsIInputStream> result;
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
// XXX if the caller wants blocking, then the caller also gets buffered!
@@ -2127,18 +2127,20 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
NS_ASYNCCOPY_VIA_WRITESEGMENTS, segsize);
if (NS_FAILED(rv)) return rv;
- *result = pipeIn;
+ result = pipeIn;
}
else
- *result = &mInput;
+ result = &mInput;
// flag input stream as open
mInputClosed = false;
rv = PostEvent(MSG_ENSURE_CONNECT);
- if (NS_FAILED(rv)) return rv;
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
- NS_ADDREF(*result);
+ result.forget(aResult);
return NS_OK;
}
@@ -2146,7 +2148,7 @@ NS_IMETHODIMP
nsSocketTransport::OpenOutputStream(uint32_t flags,
uint32_t segsize,
uint32_t segcount,
- nsIOutputStream **result)
+ nsIOutputStream **aResult)
{
SOCKET_LOG(("nsSocketTransport::OpenOutputStream [this=%p flags=%x]\n",
this, flags));
@@ -2155,6 +2157,8 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
nsresult rv;
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
+ nsCOMPtr<nsIOutputStream> result;
+
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
// XXX if the caller wants blocking, then the caller also gets buffered!
//bool openBuffered = !(flags & OPEN_UNBUFFERED);
@@ -2173,10 +2177,10 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
NS_ASYNCCOPY_VIA_READSEGMENTS, segsize);
if (NS_FAILED(rv)) return rv;
- *result = pipeOut;
+ result = pipeOut;
}
else
- *result = &mOutput;
+ result = &mOutput;
// flag output stream as open
mOutputClosed = false;
@@ -2184,7 +2188,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
rv = PostEvent(MSG_ENSURE_CONNECT);
if (NS_FAILED(rv)) return rv;
- NS_ADDREF(*result);
+ result.forget(aResult);
return NS_OK;
}