Index: webrtc/p2p/base/stun.cc |
diff --git a/webrtc/p2p/base/stun.cc b/webrtc/p2p/base/stun.cc |
index 658984a64364b08058d064502a789aa11c3452e1..3d11c71cd3f3c59a8e144cd0557459958bcb9392 100644 |
--- a/webrtc/p2p/base/stun.cc |
+++ b/webrtc/p2p/base/stun.cc |
@@ -15,6 +15,7 @@ |
#include <memory> |
#include "webrtc/base/byteorder.h" |
+#include "webrtc/base/checks.h" |
#include "webrtc/base/common.h" |
#include "webrtc/base/crc32.h" |
#include "webrtc/base/logging.h" |
@@ -48,7 +49,7 @@ StunMessage::StunMessage() |
: type_(0), |
length_(0), |
transaction_id_(EMPTY_TRANSACTION_ID) { |
- ASSERT(IsValidTransactionId(transaction_id_)); |
+ RTC_DCHECK(IsValidTransactionId(transaction_id_)); |
attrs_ = new std::vector<StunAttribute*>(); |
} |
@@ -61,7 +62,7 @@ StunMessage::~StunMessage() { |
bool StunMessage::IsLegacy() const { |
if (transaction_id_.size() == kStunLegacyTransactionIdLength) |
return true; |
- ASSERT(transaction_id_.size() == kStunTransactionIdLength); |
+ RTC_DCHECK(transaction_id_.size() == kStunTransactionIdLength); |
return false; |
} |
@@ -198,7 +199,7 @@ bool StunMessage::ValidateMessageIntegrity(const char* data, size_t size, |
password.c_str(), password.size(), |
temp_data.get(), mi_pos, |
hmac, sizeof(hmac)); |
- ASSERT(ret == sizeof(hmac)); |
+ RTC_DCHECK(ret == sizeof(hmac)); |
if (ret != sizeof(hmac)) |
return false; |
@@ -233,7 +234,7 @@ bool StunMessage::AddMessageIntegrity(const char* key, |
key, keylen, |
buf.Data(), msg_len_for_hmac, |
hmac, sizeof(hmac)); |
- ASSERT(ret == sizeof(hmac)); |
+ RTC_DCHECK(ret == sizeof(hmac)); |
if (ret != sizeof(hmac)) { |
LOG(LS_ERROR) << "HMAC computation failed. Message-Integrity " |
<< "has dummy value."; |
@@ -324,7 +325,7 @@ bool StunMessage::Read(ByteBufferReader* buf) { |
// RFC3489 instead of RFC5389. |
transaction_id.insert(0, magic_cookie); |
} |
- ASSERT(IsValidTransactionId(transaction_id)); |
+ RTC_DCHECK(IsValidTransactionId(transaction_id)); |
transaction_id_ = transaction_id; |
if (length_ != buf->Length()) |
@@ -357,7 +358,7 @@ bool StunMessage::Read(ByteBufferReader* buf) { |
} |
} |
- ASSERT(buf->Length() == rest); |
+ RTC_DCHECK(buf->Length() == rest); |
return true; |
} |
@@ -655,12 +656,12 @@ StunUInt32Attribute::StunUInt32Attribute(uint16_t type) |
} |
bool StunUInt32Attribute::GetBit(size_t index) const { |
- ASSERT(index < 32); |
+ RTC_DCHECK(index < 32); |
return static_cast<bool>((bits_ >> index) & 0x1); |
} |
void StunUInt32Attribute::SetBit(size_t index, bool value) { |
- ASSERT(index < 32); |
+ RTC_DCHECK(index < 32); |
bits_ &= ~(1 << index); |
bits_ |= value ? (1 << index) : 0; |
} |
@@ -731,14 +732,14 @@ void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { |
} |
uint8_t StunByteStringAttribute::GetByte(size_t index) const { |
- ASSERT(bytes_ != NULL); |
- ASSERT(index < length()); |
+ RTC_DCHECK(bytes_ != NULL); |
+ RTC_DCHECK(index < length()); |
return static_cast<uint8_t>(bytes_[index]); |
} |
void StunByteStringAttribute::SetByte(size_t index, uint8_t value) { |
- ASSERT(bytes_ != NULL); |
- ASSERT(index < length()); |
+ RTC_DCHECK(bytes_ != NULL); |
+ RTC_DCHECK(index < length()); |
bytes_[index] = value; |
} |