Bug 737164 part C - switch various in-tree callers which are using fallible strings to keep using them

--HG--
extra : rebase_source : f5b42ba1f5745b256ba4e4ca67c883696904f9c1
This commit is contained in:
Benjamin Smedberg 2012-05-08 13:55:24 -04:00
parent a2f29bbb52
commit d1c11dffe5
3 changed files with 7 additions and 4 deletions

View File

@ -881,7 +881,7 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
&destBufferLen);
NS_ENSURE_SUCCESS(rv, rv);
if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen)) {
if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen, fallible_t())) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -50,6 +50,8 @@
#include <base64.h>
#include <nsString.h>
using mozilla::fallible_t;
static bool
hex_from_2char(const unsigned char *c2, unsigned char *byteval)
{
@ -105,7 +107,7 @@ static bool
toHexString(const unsigned char * str, unsigned len, nsACString & out)
{
static const char digits[] = "0123456789ABCDEF";
if (!out.SetCapacity(2 * len))
if (!out.SetCapacity(2 * len, fallible_t()))
return false;
out.SetLength(0);
for (unsigned i = 0; i < len; ++i) {
@ -332,7 +334,7 @@ setBase64(const unsigned char * data, unsigned len, nsACString & out)
if (base64 != NULL) {
size_t len = PORT_Strlen(base64);
if (out.SetCapacity(len)) {
if (out.SetCapacity(len, fallible_t())) {
out.SetLength(0);
out.Append(base64, len);
PORT_Free((void*) base64);

View File

@ -249,7 +249,8 @@ Base64urlEncode(const PRUint8* aBytes,
// result, we set the capacity to be one greater than what we need, and the
// length to our desired length.
PRUint32 length = (aNumBytes + 2) / 3 * 4; // +2 due to integer math.
NS_ENSURE_TRUE(_result.SetCapacity(length + 1), NS_ERROR_OUT_OF_MEMORY);
NS_ENSURE_TRUE(_result.SetCapacity(length + 1, fallible_t()),
NS_ERROR_OUT_OF_MEMORY);
_result.SetLength(length);
(void)PL_Base64Encode(reinterpret_cast<const char*>(aBytes), aNumBytes,
_result.BeginWriting());