зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1617415 - Remove nsTSubstring<T>::ReplaceASCII. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D63775 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b5b83a0cb5
Коммит
a37fc61f17
|
@ -1142,7 +1142,7 @@ static void GetRealmName(JS::Realm* realm, nsCString& name, int* anonymizeID,
|
|||
}
|
||||
}
|
||||
if (lastSlashPos != -1) {
|
||||
name.ReplaceASCII(pathPos, lastSlashPos - pathPos, "<anonymized>");
|
||||
name.ReplaceLiteral(pathPos, lastSlashPos - pathPos, "<anonymized>");
|
||||
} else {
|
||||
// Something went wrong. Anonymize the entire path to be
|
||||
// safe.
|
||||
|
|
|
@ -657,45 +657,6 @@ bool nsTSubstring<T>::Replace(index_type aCutStart, size_type aCutLength,
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void nsTSubstring<T>::ReplaceASCII(index_type aCutStart, size_type aCutLength,
|
||||
const char* aData, size_type aLength) {
|
||||
if (!ReplaceASCII(aCutStart, aCutLength, aData, aLength, mozilla::fallible)) {
|
||||
AllocFailed(this->Length() - aCutLength + 1);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool nsTSubstring<T>::ReplaceASCII(index_type aCutStart, size_type aCutLength,
|
||||
const char* aData, size_type aLength,
|
||||
const fallible_t& aFallible) {
|
||||
if (aLength == size_type(-1)) {
|
||||
aLength = strlen(aData);
|
||||
}
|
||||
|
||||
// A Unicode string can't depend on an ASCII string buffer,
|
||||
// so this dependence check only applies to CStrings.
|
||||
#ifdef CharT_is_char
|
||||
if (this->IsDependentOn(aData, aData + aLength)) {
|
||||
nsTAutoString_CharT temp(aData, aLength);
|
||||
return Replace(aCutStart, aCutLength, temp, aFallible);
|
||||
}
|
||||
#endif
|
||||
|
||||
aCutStart = XPCOM_MIN(aCutStart, this->Length());
|
||||
|
||||
bool ok = ReplacePrep(aCutStart, aCutLength, aLength);
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aLength > 0) {
|
||||
char_traits::copyASCII(this->mData + aCutStart, aData, aLength);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void nsTSubstring<T>::Replace(index_type aCutStart, size_type aCutLength,
|
||||
const substring_tuple_type& aTuple) {
|
||||
|
|
|
@ -545,21 +545,11 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
|
|||
void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
|
||||
const substring_tuple_type& aTuple);
|
||||
|
||||
void NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
|
||||
const char* aData,
|
||||
size_type aLength = size_type(-1));
|
||||
|
||||
MOZ_MUST_USE bool NS_FASTCALL ReplaceASCII(index_type aCutStart,
|
||||
size_type aCutLength,
|
||||
const char* aData,
|
||||
size_type aLength,
|
||||
const fallible_t&);
|
||||
|
||||
// ReplaceLiteral must ONLY be called with an actual literal string, or
|
||||
// a character array *constant* of static storage duration declared
|
||||
// without an explicit size and with an initializer that is a string
|
||||
// literal or is otherwise null-terminated.
|
||||
// Use Replace or ReplaceASCII for other character array variables.
|
||||
// Use Replace for other character array variables.
|
||||
template <int N>
|
||||
void ReplaceLiteral(index_type aCutStart, size_type aCutLength,
|
||||
const char_type (&aStr)[N]) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче