forked from mirrors/gecko-dev
Bug 1857751 - nsTSubstring.cpp: Do not use 'else' after 'return'. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D191019
This commit is contained in:
parent
5dc67ae3c7
commit
8b0d915b69
1 changed files with 5 additions and 6 deletions
|
|
@ -516,7 +516,8 @@ bool nsTSubstring<T>::Assign(const self_type& aStr,
|
||||||
// get an owning reference to the this->mData
|
// get an owning reference to the this->mData
|
||||||
nsStringBuffer::FromData(this->mData)->AddRef();
|
nsStringBuffer::FromData(this->mData)->AddRef();
|
||||||
return true;
|
return true;
|
||||||
} else if (aStr.mDataFlags & DataFlags::LITERAL) {
|
}
|
||||||
|
if (aStr.mDataFlags & DataFlags::LITERAL) {
|
||||||
MOZ_ASSERT(aStr.mDataFlags & DataFlags::TERMINATED, "Unterminated literal");
|
MOZ_ASSERT(aStr.mDataFlags & DataFlags::TERMINATED, "Unterminated literal");
|
||||||
|
|
||||||
AssignLiteral(aStr.mData, aStr.mLength);
|
AssignLiteral(aStr.mData, aStr.mLength);
|
||||||
|
|
@ -1312,7 +1313,7 @@ int_type ToIntegerCommon(const nsTSubstring<T>& aSrc, nsresult* aErrorCode,
|
||||||
// 16 we'd skip the 'G', and parse just 'e' returning 14.
|
// 16 we'd skip the 'G', and parse just 'e' returning 14.
|
||||||
while ((cp < endcp) && (!done)) {
|
while ((cp < endcp) && (!done)) {
|
||||||
switch (*cp++) {
|
switch (*cp++) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
|
@ -1347,16 +1348,14 @@ int_type ToIntegerCommon(const nsTSubstring<T>& aSrc, nsresult* aErrorCode,
|
||||||
if (10 == aRadix) {
|
if (10 == aRadix) {
|
||||||
// Invalid base 10 digit, error out.
|
// Invalid base 10 digit, error out.
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
result = (aRadix * result) + ((theChar - 'A') + 10);
|
|
||||||
}
|
}
|
||||||
|
result = (aRadix * result) + ((theChar - 'A') + 10);
|
||||||
} else if ((theChar >= 'a') && (theChar <= 'f')) {
|
} else if ((theChar >= 'a') && (theChar <= 'f')) {
|
||||||
if (10 == aRadix) {
|
if (10 == aRadix) {
|
||||||
// Invalid base 10 digit, error out.
|
// Invalid base 10 digit, error out.
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
result = (aRadix * result) + ((theChar - 'a') + 10);
|
|
||||||
}
|
}
|
||||||
|
result = (aRadix * result) + ((theChar - 'a') + 10);
|
||||||
} else if ((('X' == theChar) || ('x' == theChar)) && result == 0) {
|
} else if ((('X' == theChar) || ('x' == theChar)) && result == 0) {
|
||||||
// For some reason we support a leading 'x' regardless of radix. For
|
// For some reason we support a leading 'x' regardless of radix. For
|
||||||
// example: "000000x500", aRadix = 10 would be parsed as 500 rather
|
// example: "000000x500", aRadix = 10 would be parsed as 500 rather
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue