From 4a4db06c695279b793327b91128ae035c1451927 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sun, 23 Dec 2012 20:45:57 -0800 Subject: [PATCH] Bug 824397 - Use NS_ENSURE_{TRUE,FALSE,SUCCESS}_VOID(foo) instead of NS_ENSURE_{TRUE,FALSE,SUCCESS}(foo, ). r=derf. --- .../html/content/src/nsTextEditorState.cpp | 2 +- content/media/MediaDecoder.cpp | 6 ++--- content/media/dash/DASHDecoder.cpp | 6 ++--- content/media/dash/DASHReader.cpp | 18 +++++++------- content/media/dash/DASHRepDecoder.h | 2 +- content/media/webm/WebMReader.cpp | 12 +++++----- content/media/wmf/WMFReader.cpp | 2 +- layout/base/nsCaret.cpp | 2 +- layout/generic/nsObjectFrame.cpp | 2 +- layout/style/nsHTMLStyleSheet.cpp | 2 +- .../src/peerconnection/PeerConnectionImpl.cpp | 2 +- netwerk/dash/mpd/AdaptationSet.cpp | 4 ++-- netwerk/dash/mpd/MPD.cpp | 4 ++-- netwerk/dash/mpd/Period.cpp | 2 +- netwerk/dash/mpd/Representation.cpp | 4 ++-- netwerk/dash/mpd/SegmentBase.cpp | 14 +++++------ netwerk/dash/mpd/nsDASHMPDParser.cpp | 20 ++++++++-------- netwerk/dash/mpd/nsDASHWebMODManager.cpp | 2 +- netwerk/sctp/datachannel/DataChannel.cpp | 24 +++++++++---------- widget/gtk2/nsGtkKeyUtils.cpp | 2 +- widget/qt/nsWindow.cpp | 3 ++- xpcom/io/nsAnonymousTemporaryFile.cpp | 6 ++--- 22 files changed, 71 insertions(+), 70 deletions(-) diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index 37124a2a528..8dbcda098da 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -1426,7 +1426,7 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame) // If it was, however, it should be unbounded from the same frame. NS_ASSERTION(!aFrame || aFrame == mBoundFrame, "Unbinding from the wrong frame"); - NS_ENSURE_TRUE(!aFrame || aFrame == mBoundFrame, ); + NS_ENSURE_TRUE_VOID(!aFrame || aFrame == mBoundFrame); // We need to start storing the value outside of the editor if we're not // going to use it anymore, so retrieve it for now. diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index 21187802b12..8a470daf07e 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -974,7 +974,7 @@ void MediaDecoder::NotifyPrincipalChanged() void MediaDecoder::NotifyBytesConsumed(int64_t aBytes) { - NS_ENSURE_TRUE(mDecoderStateMachine, ); + NS_ENSURE_TRUE_VOID(mDecoderStateMachine); ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); MOZ_ASSERT(OnStateMachineThread() || mDecoderStateMachine->OnDecodeThread()); if (!mIgnoreProgressData) { @@ -1206,7 +1206,7 @@ void MediaDecoder::SetDuration(double aDuration) void MediaDecoder::SetMediaDuration(int64_t aDuration) { - NS_ENSURE_TRUE(GetStateMachine(), ); + NS_ENSURE_TRUE_VOID(GetStateMachine()); GetStateMachine()->SetDuration(aDuration); } @@ -1274,7 +1274,7 @@ void MediaDecoder::SetFragmentEndTime(double aTime) void MediaDecoder::SetMediaEndTime(int64_t aTime) { - NS_ENSURE_TRUE(GetStateMachine(), ); + NS_ENSURE_TRUE_VOID(GetStateMachine()); GetStateMachine()->SetMediaEndTime(aTime); } diff --git a/content/media/dash/DASHDecoder.cpp b/content/media/dash/DASHDecoder.cpp index 75cb830e7f5..503ad2be075 100644 --- a/content/media/dash/DASHDecoder.cpp +++ b/content/media/dash/DASHDecoder.cpp @@ -235,7 +235,7 @@ DASHDecoder::NotifyDownloadEnded(nsresult aStatus) // Create reader thread for |ChannelMediaResource|::|Read|. nsCOMPtr event = NS_NewRunnableMethod(this, &DASHDecoder::ReadMPDBuffer); - NS_ENSURE_TRUE(event, ); + NS_ENSURE_TRUE_VOID(event); nsresult rv = NS_NewNamedThread("DASH MPD Reader", getter_AddRefs(mMPDReaderThread), @@ -792,12 +792,12 @@ DASHDecoder::Shutdown() // Call parent class shutdown. MediaDecoder::Shutdown(); - NS_ENSURE_TRUE(mShuttingDown, ); + NS_ENSURE_TRUE_VOID(mShuttingDown); // Shutdown reader thread if not already done. if (mMPDReaderThread) { nsresult rv = mMPDReaderThread->Shutdown(); - NS_ENSURE_SUCCESS(rv, ); + NS_ENSURE_SUCCESS_VOID(rv); mMPDReaderThread = nullptr; } diff --git a/content/media/dash/DASHReader.cpp b/content/media/dash/DASHReader.cpp index 582ebcc1887..895a6483027 100644 --- a/content/media/dash/DASHReader.cpp +++ b/content/media/dash/DASHReader.cpp @@ -97,7 +97,7 @@ void DASHReader::AddAudioReader(DASHRepReader* aAudioReader) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); - NS_ENSURE_TRUE(aAudioReader, ); + NS_ENSURE_TRUE_VOID(aAudioReader); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); @@ -111,7 +111,7 @@ void DASHReader::AddVideoReader(DASHRepReader* aVideoReader) { NS_ASSERTION(NS_IsMainThread(), "Should be on main thread."); - NS_ENSURE_TRUE(aVideoReader, ); + NS_ENSURE_TRUE_VOID(aVideoReader); ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); @@ -504,8 +504,8 @@ DASHReader::PossiblySwitchVideoReaders() } // Only switch if we reached a switch access point. - NS_ENSURE_TRUE(0 <= mSwitchCount, ); - NS_ENSURE_TRUE((uint32_t)mSwitchCount < mSwitchToVideoSubsegmentIndexes.Length(), ); + NS_ENSURE_TRUE_VOID(0 <= mSwitchCount); + NS_ENSURE_TRUE_VOID((uint32_t)mSwitchCount < mSwitchToVideoSubsegmentIndexes.Length()); uint32_t switchIdx = mSwitchToVideoSubsegmentIndexes[mSwitchCount]; if (!mVideoReader->HasReachedSubsegment(switchIdx)) { return; @@ -514,12 +514,12 @@ DASHReader::PossiblySwitchVideoReaders() // Get Representation index to switch to. DASHDecoder* dashDecoder = static_cast(mDecoder); int32_t toReaderIdx = dashDecoder->GetRepIdxForVideoSubsegmentLoad(switchIdx); - NS_ENSURE_TRUE(0 <= toReaderIdx, ); - NS_ENSURE_TRUE((uint32_t)toReaderIdx < mVideoReaders.Length(), ); + NS_ENSURE_TRUE_VOID(0 <= toReaderIdx); + NS_ENSURE_TRUE_VOID((uint32_t)toReaderIdx < mVideoReaders.Length()); DASHRepReader* fromReader = mVideoReader; DASHRepReader* toReader = mVideoReaders[toReaderIdx]; - NS_ENSURE_TRUE(fromReader != toReader, ); + NS_ENSURE_TRUE_VOID(fromReader != toReader); LOG("Switching video readers now from [%p] to [%p] at subsegment [%d]: " "mSwitchCount [%d].", @@ -538,8 +538,8 @@ DASHReader::PossiblySwitchVideoReaders() fromReader = toReader; toReaderIdx = dashDecoder->GetRepIdxForVideoSubsegmentLoad(switchIdx); toReader = mVideoReaders[toReaderIdx]; - NS_ENSURE_TRUE((uint32_t)toReaderIdx < mVideoReaders.Length(), ); - NS_ENSURE_TRUE(fromReader != toReader, ); + NS_ENSURE_TRUE_VOID((uint32_t)toReaderIdx < mVideoReaders.Length()); + NS_ENSURE_TRUE_VOID(fromReader != toReader); // Tell the SWITCH FROM reader when it should stop reading. fromReader->RequestSwitchAtSubsegment(switchIdx, toReader); diff --git a/content/media/dash/DASHRepDecoder.h b/content/media/dash/DASHRepDecoder.h index 5338faf6ec8..a31dd7fbe0c 100644 --- a/content/media/dash/DASHRepDecoder.h +++ b/content/media/dash/DASHRepDecoder.h @@ -178,7 +178,7 @@ public: mDecoderStateMachine = nullptr; // Call parent class shutdown. MediaDecoder::Shutdown(); - NS_ENSURE_TRUE(mShuttingDown, ); + NS_ENSURE_TRUE_VOID(mShuttingDown); // Cleanup ref to main decoder. mMainDecoder = nullptr; } diff --git a/content/media/webm/WebMReader.cpp b/content/media/webm/WebMReader.cpp index 1c3f1486778..5562d2f890a 100644 --- a/content/media/webm/WebMReader.cpp +++ b/content/media/webm/WebMReader.cpp @@ -1030,10 +1030,10 @@ WebMReader::RequestSwitchAtSubsegment(int32_t aSubsegmentIdx, if (mSwitchingCluster != -1) { return; } - NS_ENSURE_TRUE((uint32_t)aSubsegmentIdx < mClusterByteRanges.Length(), ); + NS_ENSURE_TRUE_VOID((uint32_t)aSubsegmentIdx < mClusterByteRanges.Length()); mSwitchingCluster = aSubsegmentIdx; - NS_ENSURE_TRUE(aNextReader, ); - NS_ENSURE_TRUE(aNextReader != this, ); + NS_ENSURE_TRUE_VOID(aNextReader); + NS_ENSURE_TRUE_VOID(aNextReader != this); mNextReader = static_cast(aNextReader); } @@ -1053,7 +1053,7 @@ WebMReader::RequestSeekToSubsegment(uint32_t aIdx) if (mSeekToCluster != -1) { return; } - NS_ENSURE_TRUE(aIdx < mClusterByteRanges.Length(), ); + NS_ENSURE_TRUE_VOID(aIdx < mClusterByteRanges.Length()); mSeekToCluster = aIdx; // XXX Hack to get the resource to seek to the correct offset if the decode @@ -1080,12 +1080,12 @@ WebMReader::SeekToCluster(uint32_t aIdx) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); NS_ASSERTION(0 <= mSeekToCluster, "mSeekToCluster should be set."); - NS_ENSURE_TRUE(aIdx < mClusterByteRanges.Length(), ); + NS_ENSURE_TRUE_VOID(aIdx < mClusterByteRanges.Length()); LOG(PR_LOG_DEBUG, ("Reader [%p] for Decoder [%p]: seeking to " "subsegment [%lld] at offset [%lld]", this, mDecoder, aIdx, mClusterByteRanges[aIdx].mStart)); int r = nestegg_offset_seek(mContext, mClusterByteRanges[aIdx].mStart); - NS_ENSURE_TRUE(r == 0, ); + NS_ENSURE_TRUE_VOID(r == 0); mSeekToCluster = -1; } diff --git a/content/media/wmf/WMFReader.cpp b/content/media/wmf/WMFReader.cpp index 9644df26dd3..784e810e7a0 100644 --- a/content/media/wmf/WMFReader.cpp +++ b/content/media/wmf/WMFReader.cpp @@ -65,7 +65,7 @@ WMFReader::OnDecodeThreadStart() { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); - NS_ENSURE_TRUE(SUCCEEDED(hr), ); + NS_ENSURE_TRUE_VOID(SUCCEEDED(hr)); } void diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 280212cec0e..0e1510a9b06 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -986,7 +986,7 @@ void nsCaret::DrawCaret(bool aInvalidate) // Can we draw the caret now? nsCOMPtr presShell = do_QueryReferent(mPresShell); - NS_ENSURE_TRUE(presShell, /**/); + NS_ENSURE_TRUE_VOID(presShell); { if (presShell->IsPaintingSuppressed()) { diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 4f097673b05..10aa3371f2c 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -637,7 +637,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize) NPWindow *window; mInstanceOwner->GetWindow(window); - NS_ENSURE_TRUE(window, /**/); + NS_ENSURE_TRUE_VOID(window); #ifdef XP_MACOSX nsWeakFrame weakFrame(this); diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 59f241386c6..9fcab9dbf3f 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -464,7 +464,7 @@ nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped) void nsHTMLStyleSheet::DropMappedAttributes(nsMappedAttributes* aMapped) { - NS_ENSURE_TRUE(aMapped, /**/); + NS_ENSURE_TRUE_VOID(aMapped); NS_ASSERTION(mMappedAttrTable.ops, "table uninitialized"); #ifdef DEBUG diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 53b8bb5199f..b3eb89cf754 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -572,7 +572,7 @@ PeerConnectionImpl::NotifyDataChannel(mozilla::DataChannel *aChannel) nsCOMPtr domchannel; nsresult rv = NS_NewDOMDataChannel(aChannel, mWindow, getter_AddRefs(domchannel)); - NS_ENSURE_SUCCESS(rv,); + NS_ENSURE_SUCCESS_VOID(rv); RUN_ON_THREAD(mThread, WrapRunnableNM(NotifyDataChannel_m, diff --git a/netwerk/dash/mpd/AdaptationSet.cpp b/netwerk/dash/mpd/AdaptationSet.cpp index ffa5011a19c..a871e269d6d 100644 --- a/netwerk/dash/mpd/AdaptationSet.cpp +++ b/netwerk/dash/mpd/AdaptationSet.cpp @@ -79,7 +79,7 @@ AdaptationSet::GetMIMEType(nsAString& aMIMEType) const void AdaptationSet::SetMIMEType(nsAString const &aMIMEType) { - NS_ENSURE_FALSE(aMIMEType.IsEmpty(),); + NS_ENSURE_FALSE_VOID(aMIMEType.IsEmpty()); mMIMEType = aMIMEType; } @@ -93,7 +93,7 @@ AdaptationSet::GetRepresentation(uint32_t aIndex) const void AdaptationSet::AddRepresentation(Representation* aRep) { - NS_ENSURE_TRUE(aRep,); + NS_ENSURE_TRUE_VOID(aRep); // Only add if it's not already in the array. if (!mRepresentations.Contains(aRep)) { mRepresentations.InsertElementSorted(aRep, CompareRepresentationBitrates()); diff --git a/netwerk/dash/mpd/MPD.cpp b/netwerk/dash/mpd/MPD.cpp index 6b48033e5b4..6723da2cd61 100644 --- a/netwerk/dash/mpd/MPD.cpp +++ b/netwerk/dash/mpd/MPD.cpp @@ -50,7 +50,7 @@ namespace net { void MPD::AddPeriod(Period* aPeriod) { - NS_ENSURE_TRUE(aPeriod,); + NS_ENSURE_TRUE_VOID(aPeriod); // Only add |Period| if it's not in the array already. if (!mPeriods.Contains(aPeriod)) { mPeriods.AppendElement(aPeriod); @@ -73,7 +73,7 @@ MPD::GetNumPeriods() const void MPD::AddBaseUrl(nsAString const& aUrl) { - NS_ENSURE_FALSE(aUrl.IsEmpty(),); + NS_ENSURE_FALSE_VOID(aUrl.IsEmpty()); // Only add |BaseUrl| string if it's not in the array already. if (!mBaseUrls.Contains(aUrl)) { mBaseUrls.AppendElement(aUrl); diff --git a/netwerk/dash/mpd/Period.cpp b/netwerk/dash/mpd/Period.cpp index a1e36fb5bae..aed37e42f64 100644 --- a/netwerk/dash/mpd/Period.cpp +++ b/netwerk/dash/mpd/Period.cpp @@ -57,7 +57,7 @@ Period::GetAdaptationSet(uint32_t aIndex) const void Period::AddAdaptationSet(AdaptationSet* aAdaptationSet) { - NS_ENSURE_TRUE(aAdaptationSet,); + NS_ENSURE_TRUE_VOID(aAdaptationSet); // Only add |AdaptationSet| ptr if it's not in the array already. if (!mAdaptationSets.Contains(aAdaptationSet)) { mAdaptationSets.AppendElement(aAdaptationSet); diff --git a/netwerk/dash/mpd/Representation.cpp b/netwerk/dash/mpd/Representation.cpp index 279e13fd3f5..efd3d7bbede 100644 --- a/netwerk/dash/mpd/Representation.cpp +++ b/netwerk/dash/mpd/Representation.cpp @@ -85,7 +85,7 @@ Representation::GetHeight() const void Representation::AddBaseUrl(nsAString const& aUrl) { - NS_ENSURE_FALSE(aUrl.IsEmpty(),); + NS_ENSURE_FALSE_VOID(aUrl.IsEmpty()); // Only add if it's not already in the array. if (!mBaseUrls.Contains(aUrl)) { mBaseUrls.AppendElement(aUrl); @@ -108,7 +108,7 @@ Representation::GetSegmentBase() const void Representation::SetSegmentBase(SegmentBase* aBase) { - NS_ENSURE_TRUE(aBase,); + NS_ENSURE_TRUE_VOID(aBase); // Don't reassign if the ptrs or contents are equal. if (mSegmentBase != aBase || (mSegmentBase && (*mSegmentBase != *aBase))) { diff --git a/netwerk/dash/mpd/SegmentBase.cpp b/netwerk/dash/mpd/SegmentBase.cpp index 4793a55300d..12baf6eced5 100644 --- a/netwerk/dash/mpd/SegmentBase.cpp +++ b/netwerk/dash/mpd/SegmentBase.cpp @@ -49,8 +49,8 @@ namespace net { void SegmentBase::GetIndexRange(int64_t* aStartBytes, int64_t* aEndBytes) const { - NS_ENSURE_TRUE(aStartBytes, ); - NS_ENSURE_TRUE(aEndBytes, ); + NS_ENSURE_TRUE_VOID(aStartBytes); + NS_ENSURE_TRUE_VOID(aEndBytes); *aStartBytes = mIndexRangeStart; *aEndBytes = mIndexRangeEnd; } @@ -58,8 +58,8 @@ SegmentBase::GetIndexRange(int64_t* aStartBytes, int64_t* aEndBytes) const void SegmentBase::GetInitRange(int64_t* aStartBytes, int64_t* aEndBytes) const { - NS_ENSURE_TRUE(aStartBytes, ); - NS_ENSURE_TRUE(aEndBytes, ); + NS_ENSURE_TRUE_VOID(aStartBytes); + NS_ENSURE_TRUE_VOID(aEndBytes); *aStartBytes = mInitRangeStart; *aEndBytes = mInitRangeEnd; } @@ -81,7 +81,7 @@ SegmentBase::SetRange(nsAString const &aRangeStr, int64_t &aStart, int64_t &aEnd) { - NS_ENSURE_TRUE(!aRangeStr.IsEmpty(), ); + NS_ENSURE_TRUE_VOID(!aRangeStr.IsEmpty()); nsAString::const_iterator start, end, dashStart, dashEnd; @@ -94,11 +94,11 @@ SegmentBase::SetRange(nsAString const &aRangeStr, nsAutoString temp(Substring(start, dashStart)); nsresult rv; aStart = temp.ToInteger64(&rv); - NS_ENSURE_SUCCESS(rv, ); + NS_ENSURE_SUCCESS_VOID(rv); temp = Substring(dashEnd, end); aEnd = temp.ToInteger64(&rv); - NS_ENSURE_SUCCESS(rv, ); + NS_ENSURE_SUCCESS_VOID(rv); } } diff --git a/netwerk/dash/mpd/nsDASHMPDParser.cpp b/netwerk/dash/mpd/nsDASHMPDParser.cpp index bc9aa20e755..7584a8c48ae 100644 --- a/netwerk/dash/mpd/nsDASHMPDParser.cpp +++ b/netwerk/dash/mpd/nsDASHMPDParser.cpp @@ -136,29 +136,29 @@ nsDASHMPDParser::PrintDOMElement(nsIDOMElement* aElem, int32_t offset) ss.Append(NS_LITERAL_STRING(" ")); // Tag name. nsAutoString tagName; - NS_ENSURE_SUCCESS(aElem->GetTagName(tagName),); + NS_ENSURE_SUCCESS_VOID(aElem->GetTagName(tagName)); ss += NS_LITERAL_STRING("<"); ss += tagName; // Attributes. nsCOMPtr attributes; - NS_ENSURE_SUCCESS(aElem->GetAttributes(getter_AddRefs(attributes)),); + NS_ENSURE_SUCCESS_VOID(aElem->GetAttributes(getter_AddRefs(attributes))); uint32_t count; - NS_ENSURE_SUCCESS(attributes->GetLength(&count),); + NS_ENSURE_SUCCESS_VOID(attributes->GetLength(&count)); for(uint32_t i = 0; i < count; i++) { ss += NS_LITERAL_STRING(" "); nsCOMPtr node; - NS_ENSURE_SUCCESS(attributes->Item(i, getter_AddRefs(node)), ); + NS_ENSURE_SUCCESS_VOID(attributes->Item(i, getter_AddRefs(node))); nsAutoString nodeName; - NS_ENSURE_SUCCESS(node->GetNodeName(nodeName),); + NS_ENSURE_SUCCESS_VOID(node->GetNodeName(nodeName)); ss += nodeName; nsAutoString nodeValue; - NS_ENSURE_SUCCESS(node->GetNodeValue(nodeValue),); + NS_ENSURE_SUCCESS_VOID(node->GetNodeValue(nodeValue)); if(!nodeValue.IsEmpty()) { ss += NS_LITERAL_STRING("="); ss += nodeValue; @@ -171,12 +171,12 @@ nsDASHMPDParser::PrintDOMElement(nsIDOMElement* aElem, int32_t offset) // Print for each child. nsCOMPtr child; - NS_ENSURE_SUCCESS(aElem->GetFirstElementChild(getter_AddRefs(child)),); + NS_ENSURE_SUCCESS_VOID(aElem->GetFirstElementChild(getter_AddRefs(child))); while(child) { PrintDOMElement(child, offset); - NS_ENSURE_SUCCESS(child->GetNextElementSibling(getter_AddRefs(child)),); + NS_ENSURE_SUCCESS_VOID(child->GetNextElementSibling(getter_AddRefs(child))); } } @@ -184,10 +184,10 @@ nsDASHMPDParser::PrintDOMElement(nsIDOMElement* aElem, int32_t offset) void nsDASHMPDParser::PrintDOMElements(nsIDOMElement* aRoot) { - NS_ENSURE_TRUE(aRoot, ); + NS_ENSURE_TRUE_VOID(aRoot); DASHMPDProfile profile; - NS_ENSURE_SUCCESS(GetProfile(aRoot, profile), ); + NS_ENSURE_SUCCESS_VOID(GetProfile(aRoot, profile)); LOG("Profile Is %d",(int32_t)profile); PrintDOMElement(aRoot, 0); } diff --git a/netwerk/dash/mpd/nsDASHWebMODManager.cpp b/netwerk/dash/mpd/nsDASHWebMODManager.cpp index f5e210df31f..2c337e0f965 100644 --- a/netwerk/dash/mpd/nsDASHWebMODManager.cpp +++ b/netwerk/dash/mpd/nsDASHWebMODManager.cpp @@ -57,7 +57,7 @@ static PRLogModuleInfo* gnsDASHWebMODManagerLog = nullptr; nsDASHWebMODManager::nsDASHWebMODManager(MPD* aMpd) { MOZ_COUNT_CTOR(nsDASHWebMODManager); - NS_ENSURE_TRUE(aMpd,); + NS_ENSURE_TRUE_VOID(aMpd); mMpd = aMpd; #if defined(PR_LOGGING) if(!gnsDASHWebMODManagerLog) diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index dc039a17827..47e16a553c8 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -346,7 +346,7 @@ DataChannelConnection::StartDefer() if (!mTimerRunning) { rv = mDeferredTimer->InitWithCallback(this, mDeferTimeout, nsITimer::TYPE_ONE_SHOT); - NS_ENSURE_TRUE(rv == NS_OK, /* */); + NS_ENSURE_TRUE_VOID(rv == NS_OK); mTimerRunning = true; } @@ -1058,15 +1058,15 @@ DataChannelConnection::HandleOpenResponseMessage(const struct rtcweb_datachannel streamOut = ntohs(rsp->reverse_stream); channel = FindChannelByStreamOut(streamOut); - NS_ENSURE_TRUE(channel, /* */); - NS_ENSURE_TRUE(channel->mState == CONNECTING, /* */); + NS_ENSURE_TRUE_VOID(channel); + NS_ENSURE_TRUE_VOID(channel->mState == CONNECTING); if (rsp->error) { LOG(("%s: error in response to open of channel %d (%s)", __FUNCTION__, streamOut, channel->mLabel.get())); } else { - NS_ENSURE_TRUE(!FindChannelByStreamIn(streamIn), /* */); + NS_ENSURE_TRUE_VOID(!FindChannelByStreamIn(streamIn)); channel->mStreamIn = streamIn; channel->mState = OPEN; @@ -1096,8 +1096,8 @@ DataChannelConnection::HandleOpenAckMessage(const struct rtcweb_datachannel_ack channel = FindChannelByStreamIn(streamIn); - NS_ENSURE_TRUE(channel, /* */); - NS_ENSURE_TRUE(channel->mState == CONNECTING, /* */); + NS_ENSURE_TRUE_VOID(channel); + NS_ENSURE_TRUE_VOID(channel->mState == CONNECTING); channel->mState = channel->mReady ? DataChannel::OPEN : DataChannel::WAITING_TO_OPEN; if (channel->mState == OPEN) { @@ -1131,11 +1131,11 @@ DataChannelConnection::HandleDataMessage(uint32_t ppid, channel = FindChannelByStreamIn(streamIn); // XXX A closed channel may trip this... check - NS_ENSURE_TRUE(channel, /* */); - NS_ENSURE_TRUE(channel->mState != CONNECTING, /* */); + NS_ENSURE_TRUE_VOID(channel); + NS_ENSURE_TRUE_VOID(channel->mState != CONNECTING); // XXX should this be a simple if, no warnings/debugbreaks? - NS_ENSURE_TRUE(channel->mState != CLOSED, /* */); + NS_ENSURE_TRUE_VOID(channel->mState != CLOSED); { nsAutoCString recvData(buffer, length); @@ -1211,19 +1211,19 @@ DataChannelConnection::HandleMessage(const void *buffer, size_t length, uint32_t switch (ppid) { case DATA_CHANNEL_PPID_CONTROL: - NS_ENSURE_TRUE(length >= sizeof(*ack), /* */); // Ack is the smallest + NS_ENSURE_TRUE_VOID(length >= sizeof(*ack)); // Ack is the smallest msg = static_cast(buffer); switch (msg->msg_type) { case DATA_CHANNEL_OPEN_REQUEST: LOG(("length %u, sizeof(*req) = %u", length, sizeof(*req))); - NS_ENSURE_TRUE(length >= sizeof(*req), /* */); + NS_ENSURE_TRUE_VOID(length >= sizeof(*req)); req = static_cast(buffer); HandleOpenRequestMessage(req, length, streamIn); break; case DATA_CHANNEL_OPEN_RESPONSE: - NS_ENSURE_TRUE(length >= sizeof(*rsp), /* */); + NS_ENSURE_TRUE_VOID(length >= sizeof(*rsp)); rsp = static_cast(buffer); HandleOpenResponseMessage(rsp, length, streamIn); diff --git a/widget/gtk2/nsGtkKeyUtils.cpp b/widget/gtk2/nsGtkKeyUtils.cpp index a58a0b29134..67d61ceae83 100644 --- a/widget/gtk2/nsGtkKeyUtils.cpp +++ b/widget/gtk2/nsGtkKeyUtils.cpp @@ -1188,7 +1188,7 @@ void KeymapWrapper::InitKeypressEvent(nsKeyEvent& aKeyEvent, GdkEventKey* aGdkKeyEvent) { - NS_ENSURE_TRUE(aKeyEvent.message == NS_KEY_PRESS, ); + NS_ENSURE_TRUE_VOID(aKeyEvent.message == NS_KEY_PRESS); aKeyEvent.charCode = GetCharCodeFor(aGdkKeyEvent); if (!aKeyEvent.charCode) { diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 310bbf42682..39ec4c3ab10 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -3251,7 +3251,8 @@ nsWindow::SetSoftwareKeyboardState(bool aOpen, const InputContextAction& aAction) { if (aOpen) { - NS_ENSURE_TRUE(mInputContext.mIMEState.mEnabled != IMEState::DISABLED,); + NS_ENSURE_TRUE_VOID(mInputContext.mIMEState.mEnabled != + IMEState::DISABLED); // Ensure that opening the virtual keyboard is allowed for this specific // InputContext depending on the content.ime.strict.policy pref diff --git a/xpcom/io/nsAnonymousTemporaryFile.cpp b/xpcom/io/nsAnonymousTemporaryFile.cpp index dec1e06249e..a422d4d63c9 100644 --- a/xpcom/io/nsAnonymousTemporaryFile.cpp +++ b/xpcom/io/nsAnonymousTemporaryFile.cpp @@ -211,12 +211,12 @@ public: void RemoveAnonTempFileFiles() { nsCOMPtr tmpDir; nsresult rv = GetTempDir(getter_AddRefs(tmpDir)); - NS_ENSURE_SUCCESS(rv,); + NS_ENSURE_SUCCESS_VOID(rv); - // Remove the directory recursively. + // Remove the directory recursively. tmpDir->Remove(true); } - + private: nsCOMPtr mTimer; };