Replace the easy cases of VERIFY usage.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2652653012
Cr-Commit-Position: refs/heads/master@{#16370}
This commit is contained in:
nisse
2017-01-31 00:57:56 -08:00
committed by Commit bot
parent 96a9fa0291
commit 7ce109acd3
5 changed files with 20 additions and 18 deletions

View File

@ -15,7 +15,7 @@
#include <memory>
#include <vector>
#include "webrtc/base/common.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/messagedigest.h"
#include "webrtc/base/sslidentity.h"
@ -45,7 +45,7 @@ class FakeSSLCertificate : public rtc::SSLCertificate {
}
void ToDER(Buffer* der_buffer) const override {
std::string der_string;
VERIFY(SSLIdentity::PemToDer(kPemTypeCertificate, data_, &der_string));
RTC_CHECK(SSLIdentity::PemToDer(kPemTypeCertificate, data_, &der_string));
der_buffer->SetData(der_string.c_str(), der_string.size());
}
int64_t CertificateExpirationTime() const override {

View File

@ -453,7 +453,8 @@ void MessageQueue::DoDelayPost(const Location& posted_from,
// If this message queue processes 1 message every millisecond for 50 days,
// we will wrap this number. Even then, only messages with identical times
// will be misordered, and then only briefly. This is probably ok.
VERIFY(0 != ++dmsgq_next_num_);
++dmsgq_next_num_;
RTC_DCHECK_NE(0, dmsgq_next_num_);
}
WakeUpSocketServer();
}

View File

@ -1307,8 +1307,8 @@ bool BaseChannel::RemoveRecvStream_w(uint32_t ssrc) {
bool BaseChannel::UpdateLocalStreams_w(const std::vector<StreamParams>& streams,
ContentAction action,
std::string* error_desc) {
if (!VERIFY(action == CA_OFFER || action == CA_ANSWER ||
action == CA_PRANSWER || action == CA_UPDATE))
if (!(action == CA_OFFER || action == CA_ANSWER ||
action == CA_PRANSWER || action == CA_UPDATE))
return false;
// If this is an update, streams only contain streams that have changed.
@ -1380,8 +1380,8 @@ bool BaseChannel::UpdateRemoteStreams_w(
const std::vector<StreamParams>& streams,
ContentAction action,
std::string* error_desc) {
if (!VERIFY(action == CA_OFFER || action == CA_ANSWER ||
action == CA_PRANSWER || action == CA_UPDATE))
if (!(action == CA_OFFER || action == CA_ANSWER ||
action == CA_PRANSWER || action == CA_UPDATE))
return false;
// If this is an update, streams only contain streams that have changed.

View File

@ -1014,7 +1014,7 @@ bool PeerConnection::GetStats(StatsObserver* observer,
StatsOutputLevel level) {
TRACE_EVENT0("webrtc", "PeerConnection::GetStats");
RTC_DCHECK(signaling_thread()->IsCurrent());
if (!VERIFY(observer != NULL)) {
if (!observer) {
LOG(LS_ERROR) << "GetStats - observer is NULL.";
return false;
}
@ -1097,7 +1097,7 @@ PeerConnection::CreateDataChannel(
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints) {
TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
return;
}
@ -1149,7 +1149,7 @@ void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
const RTCOfferAnswerOptions& options) {
TRACE_EVENT0("webrtc", "PeerConnection::CreateOffer");
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
return;
}
@ -1169,7 +1169,7 @@ void PeerConnection::CreateAnswer(
CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints) {
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "CreateAnswer - observer is NULL.";
return;
}
@ -1188,7 +1188,7 @@ void PeerConnection::CreateAnswer(
void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer,
const RTCOfferAnswerOptions& options) {
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "CreateAnswer - observer is NULL.";
return;
}
@ -1211,7 +1211,7 @@ void PeerConnection::SetLocalDescription(
if (IsClosed()) {
return;
}
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "SetLocalDescription - observer is NULL.";
return;
}
@ -1293,7 +1293,7 @@ void PeerConnection::SetRemoteDescription(
if (IsClosed()) {
return;
}
if (!VERIFY(observer != nullptr)) {
if (!observer) {
LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL.";
return;
}
@ -2190,7 +2190,8 @@ void PeerConnection::UpdateLocalRtpDataChannels(
// track label is the same as |streamid|.
const std::string& channel_label = params.sync_label;
auto data_channel_it = rtp_data_channels_.find(channel_label);
if (!VERIFY(data_channel_it != rtp_data_channels_.end())) {
if (data_channel_it == rtp_data_channels_.end()) {
LOG(LS_ERROR) << "channel label not found";
continue;
}
// Set the SSRC the data channel should use for sending.

View File

@ -1274,9 +1274,9 @@ bool WebRtcSession::InsertDtmf(const std::string& track_id,
return false;
}
uint32_t send_ssrc = 0;
if (!VERIFY(local_description() &&
GetAudioSsrcByTrackId(local_description()->description(),
track_id, &send_ssrc))) {
if (!(local_description() &&
GetAudioSsrcByTrackId(local_description()->description(),
track_id, &send_ssrc))) {
LOG(LS_ERROR) << "InsertDtmf: Track does not exist: " << track_id;
return false;
}