Bump to WebRTC M120 release
Some API deprecation -- ExperimentalAgc and ExperimentalNs are gone. We're continuing to carry iSAC even though it's gone upstream, but maybe we'll want to drop that soon.
This commit is contained in:
@ -20,30 +20,41 @@
|
||||
namespace rtc {
|
||||
namespace string_to_number_internal {
|
||||
|
||||
absl::optional<signed_type> ParseSigned(const char* str, int base) {
|
||||
RTC_DCHECK(str);
|
||||
if (isdigit(str[0]) || str[0] == '-') {
|
||||
absl::optional<signed_type> ParseSigned(absl::string_view str, int base) {
|
||||
if (str.empty())
|
||||
return absl::nullopt;
|
||||
|
||||
if (isdigit(static_cast<unsigned char>(str[0])) || str[0] == '-') {
|
||||
std::string str_str(str);
|
||||
char* end = nullptr;
|
||||
errno = 0;
|
||||
const signed_type value = std::strtoll(str, &end, base);
|
||||
if (end && *end == '\0' && errno == 0) {
|
||||
const signed_type value = std::strtoll(str_str.c_str(), &end, base);
|
||||
// Check for errors and also make sure that there were no embedded nuls in
|
||||
// the input string.
|
||||
if (end == str_str.c_str() + str_str.size() && errno == 0) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
absl::optional<unsigned_type> ParseUnsigned(const char* str, int base) {
|
||||
RTC_DCHECK(str);
|
||||
if (isdigit(str[0]) || str[0] == '-') {
|
||||
absl::optional<unsigned_type> ParseUnsigned(absl::string_view str, int base) {
|
||||
if (str.empty())
|
||||
return absl::nullopt;
|
||||
|
||||
if (isdigit(static_cast<unsigned char>(str[0])) || str[0] == '-') {
|
||||
std::string str_str(str);
|
||||
// Explicitly discard negative values. std::strtoull parsing causes unsigned
|
||||
// wraparound. We cannot just reject values that start with -, though, since
|
||||
// -0 is perfectly fine, as is -0000000000000000000000000000000.
|
||||
const bool is_negative = str[0] == '-';
|
||||
char* end = nullptr;
|
||||
errno = 0;
|
||||
const unsigned_type value = std::strtoull(str, &end, base);
|
||||
if (end && *end == '\0' && errno == 0 && (value == 0 || !is_negative)) {
|
||||
const unsigned_type value = std::strtoull(str_str.c_str(), &end, base);
|
||||
// Check for errors and also make sure that there were no embedded nuls in
|
||||
// the input string.
|
||||
if (end == str_str.c_str() + str_str.size() && errno == 0 &&
|
||||
(value == 0 || !is_negative)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@ -69,22 +80,25 @@ inline long double StrToT(const char* str, char** str_end) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
absl::optional<T> ParseFloatingPoint(const char* str) {
|
||||
RTC_DCHECK(str);
|
||||
if (*str == '\0')
|
||||
absl::optional<T> ParseFloatingPoint(absl::string_view str) {
|
||||
if (str.empty())
|
||||
return absl::nullopt;
|
||||
|
||||
if (str[0] == '\0')
|
||||
return absl::nullopt;
|
||||
std::string str_str(str);
|
||||
char* end = nullptr;
|
||||
errno = 0;
|
||||
const T value = StrToT<T>(str, &end);
|
||||
if (end && *end == '\0' && errno == 0) {
|
||||
const T value = StrToT<T>(str_str.c_str(), &end);
|
||||
if (end == str_str.c_str() + str_str.size() && errno == 0) {
|
||||
return value;
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
template absl::optional<float> ParseFloatingPoint(const char* str);
|
||||
template absl::optional<double> ParseFloatingPoint(const char* str);
|
||||
template absl::optional<long double> ParseFloatingPoint(const char* str);
|
||||
template absl::optional<float> ParseFloatingPoint(absl::string_view str);
|
||||
template absl::optional<double> ParseFloatingPoint(absl::string_view str);
|
||||
template absl::optional<long double> ParseFloatingPoint(absl::string_view str);
|
||||
|
||||
} // namespace string_to_number_internal
|
||||
} // namespace rtc
|
||||
|
Reference in New Issue
Block a user