Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: third_party/WebKit/Source/wtf/text/WTFString.cpp

Issue 2016223002: Revert of Replace all occurrences of RELEASE_ASSERT in wtf with CHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve conflict in StringImpl.cpp. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/text/WTFString.cpp
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.cpp b/third_party/WebKit/Source/wtf/text/WTFString.cpp
index 8e62e0848c9de852492cc1917bde0e52750f4c26..d74327953aff5a5ce825cbf95084f8285fd8c2e7 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.cpp
+++ b/third_party/WebKit/Source/wtf/text/WTFString.cpp
@@ -92,7 +92,7 @@ void String::append(const String& string)
if (m_impl->is8Bit() && string.m_impl->is8Bit()) {
LChar* data;
- CHECK_LE(string.length(), std::numeric_limits<unsigned>::max() - m_impl->length());
+ RELEASE_ASSERT(string.length() <= std::numeric_limits<unsigned>::max() - m_impl->length());
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + string.length(), data);
memcpy(data, m_impl->characters8(), m_impl->length() * sizeof(LChar));
memcpy(data + m_impl->length(), string.characters8(), string.length() * sizeof(LChar));
@@ -101,7 +101,7 @@ void String::append(const String& string)
}
UChar* data;
- CHECK_LE(string.length(), std::numeric_limits<unsigned>::max() - m_impl->length());
+ RELEASE_ASSERT(string.length() <= std::numeric_limits<unsigned>::max() - m_impl->length());
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + string.length(), data);
if (m_impl->is8Bit())
@@ -131,7 +131,7 @@ inline void String::appendInternal(CharacterType c)
// FIXME: We should be able to create an 8 bit string via this code path.
UChar* data;
- CHECK_LT(m_impl->length(), std::numeric_limits<unsigned>::max());
+ RELEASE_ASSERT(m_impl->length() < std::numeric_limits<unsigned>::max());
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
if (m_impl->is8Bit())
StringImpl::copyChars(data, m_impl->characters8(), m_impl->length());
@@ -194,7 +194,7 @@ void String::append(const LChar* charactersToAppend, unsigned lengthToAppend)
unsigned strLength = m_impl->length();
if (m_impl->is8Bit()) {
- CHECK_LE(lengthToAppend, std::numeric_limits<unsigned>::max() - strLength);
+ RELEASE_ASSERT(lengthToAppend <= std::numeric_limits<unsigned>::max() - strLength);
LChar* data;
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(strLength + lengthToAppend, data);
StringImpl::copyChars(data, m_impl->characters8(), strLength);
@@ -203,7 +203,7 @@ void String::append(const LChar* charactersToAppend, unsigned lengthToAppend)
return;
}
- CHECK_LE(lengthToAppend, std::numeric_limits<unsigned>::max() - strLength);
+ RELEASE_ASSERT(lengthToAppend <= std::numeric_limits<unsigned>::max() - strLength);
UChar* data;
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() + lengthToAppend, data);
StringImpl::copyChars(data, m_impl->characters16(), strLength);
@@ -226,7 +226,7 @@ void String::append(const UChar* charactersToAppend, unsigned lengthToAppend)
unsigned strLength = m_impl->length();
ASSERT(charactersToAppend);
- CHECK_LE(lengthToAppend, std::numeric_limits<unsigned>::max() - strLength);
+ RELEASE_ASSERT(lengthToAppend <= std::numeric_limits<unsigned>::max() - strLength);
UChar* data;
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(strLength + lengthToAppend, data);
if (m_impl->is8Bit())
@@ -245,7 +245,7 @@ PassRefPtr<StringImpl> insertInternal(PassRefPtr<StringImpl> impl, const CharTyp
ASSERT(charactersToInsert);
UChar* data; // FIXME: We should be able to create an 8 bit string here.
- CHECK_LE(lengthToInsert, std::numeric_limits<unsigned>::max() - impl->length());
+ RELEASE_ASSERT(lengthToInsert <= std::numeric_limits<unsigned>::max() - impl->length());
RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(impl->length() + lengthToInsert, data);
if (impl->is8Bit())
@@ -437,7 +437,7 @@ Vector<UChar> String::charactersWithNullTermination() const
unsigned String::copyTo(UChar* buffer, unsigned pos, unsigned maxLength) const
{
unsigned length = this->length();
- CHECK_LE(pos, length);
+ RELEASE_ASSERT(pos <= length);
unsigned numCharacters = std::min(length - pos, maxLength);
if (!numCharacters)
return 0;
@@ -876,7 +876,7 @@ String String::make16BitFrom8BitSource(const LChar* source, size_t length)
String String::fromUTF8(const LChar* stringStart, size_t length)
{
- CHECK_LE(length, std::numeric_limits<unsigned>::max());
+ RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max());
if (!stringStart)
return String();
« no previous file with comments | « third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp ('k') | third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698