Bug 1407624 - Make nsEscape.cpp build in non-unified mode. r?froydnj
nsEscape.cpp doesn't build in non-unified mode, as it uses mozilla::fallible,
mozilla::CheckedInt and mozilla::ASCIIMask::IsMasked without prefixing them
with the mozilla namespace. I suspect this file is usually included in
unified_cpp file which includes a "using namespace mozilla" directive.
MozReview-Commit-ID: GwlsK8kytLj
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -211,17 +211,17 @@ nsUnescapeCount(char* aStr)
} /* NET_UnEscapeCnt */
void
nsAppendEscapedHTML(const nsACString& aSrc, nsACString& aDst)
{
// Preparation: aDst's length will increase by at least aSrc's length. If the
// addition overflows, we skip this, which is fine, and we'll likely abort
// while (infallibly) appending due to aDst becoming too large.
- CheckedInt<nsACString::size_type> newCapacity = aDst.Length();
+ mozilla::CheckedInt<nsACString::size_type> newCapacity = aDst.Length();
newCapacity += aSrc.Length();
if (newCapacity.isValid()) {
aDst.SetCapacity(newCapacity.value());
}
for (auto cur = aSrc.BeginReading(); cur != aSrc.EndReading(); cur++) {
if (*cur == '<') {
aDst.AppendLiteral("<");
@@ -323,19 +323,19 @@ T_EscapeURL(const typename T::char_type*
bool previousIsNonASCII = false;
for (size_t i = 0; i < aPartLen; ++i) {
unsigned_char_type c = *src++;
// If there is a filter, we wish to skip any characters which match it.
// This is needed so we don't perform an extra pass just to extract the
// filtered characters.
- if (aFilterMask && ASCIIMask::IsMasked(*aFilterMask, c)) {
+ if (aFilterMask && mozilla::ASCIIMask::IsMasked(*aFilterMask, c)) {
if (!writing) {
- if (!aResult.Append(aPart, i, fallible)) {
+ if (!aResult.Append(aPart, i, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
writing = true;
}
continue;
}
// if the char has not to be escaped or whatever follows % is
@@ -359,39 +359,39 @@ T_EscapeURL(const typename T::char_type*
|| (c > 0x20 && c < 0x7f && ignoreAscii))
&& !(c == ':' && colon)
&& !(previousIsNonASCII && c == '|' && !ignoreNonAscii)) {
if (writing) {
tempBuffer[tempBufferPos++] = c;
}
} else { /* do the escape magic */
if (!writing) {
- if (!aResult.Append(aPart, i, fallible)) {
+ if (!aResult.Append(aPart, i, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
writing = true;
}
uint32_t len = ::AppendPercentHex(tempBuffer + tempBufferPos, c);
tempBufferPos += len;
MOZ_ASSERT(len <= ENCODE_MAX_LEN, "potential buffer overflow");
}
// Flush the temp buffer if it doesnt't have room for another encoded char.
if (tempBufferPos >= mozilla::ArrayLength(tempBuffer) - ENCODE_MAX_LEN) {
NS_ASSERTION(writing, "should be writing");
- if (!aResult.Append(tempBuffer, tempBufferPos, fallible)) {
+ if (!aResult.Append(tempBuffer, tempBufferPos, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
tempBufferPos = 0;
}
previousIsNonASCII = (c > 0x7f);
}
if (writing) {
- if (!aResult.Append(tempBuffer, tempBufferPos, fallible)) {
+ if (!aResult.Append(tempBuffer, tempBufferPos, mozilla::fallible)) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
aDidAppend = writing;
return NS_OK;
}
bool