diff options
author | Moonchild <moonchild@palemoon.org> | 2021-11-04 19:01:52 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-04 22:05:50 +0200 |
commit | f990d9a46ae66c5f0261cac4e33b755906456702 (patch) | |
tree | b02f99baea0726b744d251f5b0e357da4a636ee5 /netwerk/base | |
parent | 497e453fe7df656758d6a8b09b5012a30ada5031 (diff) | |
download | uxp-f990d9a46ae66c5f0261cac4e33b755906456702.tar.gz |
[network] Use a COM pointer instead of NS_ADDREF in nsSocketTransport2.cpp
Diffstat (limited to 'netwerk/base')
-rw-r--r-- | netwerk/base/nsSocketTransport2.cpp | 24 |
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; } |