Bug 1656357 - don't require flat strings in nsMediaFragmentURIParser; r=necko-reviewers,valentin

ToInteger doesn't require a null-terminated buffer, so there's no need
to flatten the string prior to extracting the integer therein.

Differential Revision: https://phabricator.services.mozilla.com/D85473
This commit is contained in:
Nathan Froyd 2020-07-31 07:05:53 +00:00
parent 541bda618d
commit ff50de591d

View File

@ -113,7 +113,7 @@ bool nsMediaFragmentURIParser::ParseNPTSec(nsDependentSubstring& aString,
nsDependentSubstring n(aString, 0, index);
nsresult ec;
int32_t s = PromiseFlatString(n).ToInteger(&ec);
int32_t s = n.ToInteger(&ec);
if (NS_FAILED(ec)) {
return false;
}
@ -218,7 +218,7 @@ bool nsMediaFragmentURIParser::ParseNPTHH(nsDependentSubstring& aString,
nsDependentSubstring n(aString, 0, index);
nsresult ec;
int32_t u = PromiseFlatString(n).ToInteger(&ec);
int32_t u = n.ToInteger(&ec);
if (NS_FAILED(ec)) {
return false;
}
@ -242,7 +242,7 @@ bool nsMediaFragmentURIParser::ParseNPTSS(nsDependentSubstring& aString,
if (IsDigit(aString[0]) && IsDigit(aString[1])) {
nsDependentSubstring n(aString, 0, 2);
nsresult ec;
int32_t u = PromiseFlatString(n).ToInteger(&ec);
int32_t u = n.ToInteger(&ec);
if (NS_FAILED(ec)) {
return false;
}
@ -265,7 +265,7 @@ static bool ParseInteger(nsDependentSubstring& aString, int32_t& aResult) {
nsDependentSubstring n(aString, 0, index);
nsresult ec;
int32_t s = PromiseFlatString(n).ToInteger(&ec);
int32_t s = n.ToInteger(&ec);
if (NS_FAILED(ec)) {
return false;
}