From 8afa7178e73523a31232420ffbc5b787f3b719bb Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Sun, 21 Jun 2015 08:31:02 -0400 Subject: [PATCH] Backed out changeset b6ac18409d64 (bug 1170809) for Werror bustage. --- dom/base/nsXMLHttpRequest.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/dom/base/nsXMLHttpRequest.cpp b/dom/base/nsXMLHttpRequest.cpp index 6f868bbae227..2912ff4fd626 100644 --- a/dom/base/nsXMLHttpRequest.cpp +++ b/dom/base/nsXMLHttpRequest.cpp @@ -678,18 +678,13 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer, &destBufferLen); NS_ENSURE_SUCCESS(rv, rv); - uint32_t size = mResponseText.Length() + destBufferLen; - if (size < destBufferLen) { - return NS_ERROR_OUT_OF_MEMORY; - } - - if (!mResponseText.SetCapacity(size, fallible)) { + if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen, fallible)) { return NS_ERROR_OUT_OF_MEMORY; } char16_t* destBuffer = mResponseText.BeginWriting() + mResponseText.Length(); - CheckedInt32 totalChars = mResponseText.Length(); + int32_t totalChars = mResponseText.Length(); // This code here is basically a copy of a similar thing in // nsScanner::Append(const char* aBuffer, uint32_t aLen). @@ -702,11 +697,9 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer, MOZ_ASSERT(NS_SUCCEEDED(rv)); totalChars += destlen; - if (!totalChars.isValid()) { - return NS_ERROR_OUT_OF_MEMORY; - } - mResponseText.SetLength(totalChars.value()); + mResponseText.SetLength(totalChars); + return NS_OK; }