Bug 1330759 part 6. Make the null-termination asserts in nsStringBuffer::ToString into diagnostic asserts. r=froydnj
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 18 Jan 2017 22:20:15 -0500
changeset 375093 5f327e934dfece65b00baf439dd1554f2ff0e990
parent 375092 1873ff6e9179711bd79ca1510383c2cdb20e00e5
child 375094 7de6b3754a9de76b6c1ca01d544118d89ea3056f
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1330759
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330759 part 6. Make the null-termination asserts in nsStringBuffer::ToString into diagnostic asserts. r=froydnj
xpcom/string/nsSubstring.cpp
--- a/xpcom/string/nsSubstring.cpp
+++ b/xpcom/string/nsSubstring.cpp
@@ -280,17 +280,18 @@ nsStringBuffer::FromString(const nsACStr
 
 void
 nsStringBuffer::ToString(uint32_t aLen, nsAString& aStr,
                          bool aMoveOwnership)
 {
   char16_t* data = static_cast<char16_t*>(Data());
 
   nsAStringAccessor* accessor = static_cast<nsAStringAccessor*>(&aStr);
-  NS_ASSERTION(data[aLen] == char16_t(0), "data should be null terminated");
+  MOZ_DIAGNOSTIC_ASSERT(data[aLen] == char16_t(0),
+                        "data should be null terminated");
 
   // preserve class flags
   uint32_t flags = accessor->flags();
   flags = (flags & 0xFFFF0000) | nsSubstring::F_SHARED | nsSubstring::F_TERMINATED;
 
   if (!aMoveOwnership) {
     AddRef();
   }
@@ -299,17 +300,18 @@ nsStringBuffer::ToString(uint32_t aLen, 
 
 void
 nsStringBuffer::ToString(uint32_t aLen, nsACString& aStr,
                          bool aMoveOwnership)
 {
   char* data = static_cast<char*>(Data());
 
   nsACStringAccessor* accessor = static_cast<nsACStringAccessor*>(&aStr);
-  NS_ASSERTION(data[aLen] == char(0), "data should be null terminated");
+  MOZ_DIAGNOSTIC_ASSERT(data[aLen] == char(0),
+                        "data should be null terminated");
 
   // preserve class flags
   uint32_t flags = accessor->flags();
   flags = (flags & 0xFFFF0000) | nsCSubstring::F_SHARED | nsCSubstring::F_TERMINATED;
 
   if (!aMoveOwnership) {
     AddRef();
   }