Accept slice in to_double.

GitOrigin-RevId: 3e68b84972a15404ab6ec43b6c157289487b3a5b
This commit is contained in:
levlam 2018-02-03 23:01:33 +03:00
parent 9d5580f315
commit 79df9bac53
5 changed files with 5 additions and 5 deletions

View File

@ -1409,7 +1409,7 @@ void InlineQueriesManager::on_get_inline_query_results(UserId bot_user_id, uint6
Location l(inline_message_geo->geo_);
location->location_ = l.get_location_object();
} else {
auto coordinates = split(result->description_);
auto coordinates = split(Slice(result->description_));
Location l(to_double(coordinates.first), to_double(coordinates.second));
location->location_ = l.get_location_object();
}

View File

@ -122,7 +122,7 @@ inline Status from_json(double &to, JsonValue &from) {
if (from.type() != JsonValue::Type::Number) {
return Status::Error(PSLICE() << "Expected number, got " << from.type());
}
to = to_double(from.get_number().str());
to = to_double(from.get_number());
return Status::OK();
}

View File

@ -623,7 +623,7 @@ Result<double> get_json_object_double_field(JsonObject &object, Slice name, bool
if (value.type() == JsonValue::Type::Null) {
return default_value;
}
return to_double(value.get_number().str());
return to_double(value.get_number());
}
Result<string> get_json_object_string_field(JsonObject &object, Slice name, bool is_optional, string default_value) {

View File

@ -58,7 +58,7 @@ string oneline(Slice str) {
return result;
}
double to_double(CSlice str) {
double to_double(Slice str) {
static TD_THREAD_LOCAL std::stringstream *ss;
if (init_thread_local<std::stringstream>(ss)) {
ss->imbue(std::locale::classic());

View File

@ -264,7 +264,7 @@ typename std::enable_if<std::is_unsigned<T>::value, T>::type hex_to_integer(Slic
return integer_value;
}
double to_double(CSlice str);
double to_double(Slice str);
template <class T>
T clamp(T value, T min_value, T max_value) {