Init some uninitialized Result variables.
GitOrigin-RevId: 48e15168e48d131c53a93a5c2971c7dadeeeb270
This commit is contained in:
parent
6810845770
commit
48740add28
@ -489,7 +489,7 @@ void InlineQueriesManager::answer_inline_query(int64 inline_query_id, bool is_pe
|
||||
int32 duration = 0;
|
||||
|
||||
FileType file_type = FileType::Temp;
|
||||
Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> r_inline_message;
|
||||
Result<tl_object_ptr<telegram_api::InputBotInlineMessage>> r_inline_message = Status::Error(500, "Uninited");
|
||||
switch (input_result->get_id()) {
|
||||
case td_api::inputInlineQueryResultAnimatedGif::ID: {
|
||||
auto animated_gif = move_tl_object_as<td_api::inputInlineQueryResultAnimatedGif>(input_result);
|
||||
|
@ -16427,7 +16427,7 @@ Result<MessagesManager::InputMessageContent> MessagesManager::process_input_mess
|
||||
|
||||
bool have_file = true;
|
||||
// TODO: send from secret chat to common
|
||||
Result<FileId> r_file_id;
|
||||
Result<FileId> r_file_id = Status::Error(500, "Have no file");
|
||||
tl_object_ptr<td_api::inputThumbnail> input_thumbnail;
|
||||
vector<FileId> sticker_file_ids;
|
||||
switch (message_type) {
|
||||
|
@ -7178,18 +7178,17 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseTextEntiti
|
||||
return make_error(400, "Parse mode must be non-empty");
|
||||
}
|
||||
|
||||
Result<vector<MessageEntity>> r_entities;
|
||||
switch (request.parse_mode_->get_id()) {
|
||||
case td_api::textParseModeHTML::ID:
|
||||
r_entities = parse_html(request.text_);
|
||||
break;
|
||||
case td_api::textParseModeMarkdown::ID:
|
||||
r_entities = parse_markdown(request.text_);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
auto r_entities = [&]() -> Result<vector<MessageEntity>> {
|
||||
switch (request.parse_mode_->get_id()) {
|
||||
case td_api::textParseModeHTML::ID:
|
||||
return parse_html(request.text_);
|
||||
case td_api::textParseModeMarkdown::ID:
|
||||
return parse_markdown(request.text_);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return Status::Error(500, "Unknown parse mode");
|
||||
}
|
||||
}();
|
||||
if (r_entities.is_error()) {
|
||||
return make_error(400, PSLICE() << "Can't parse entities: " << r_entities.error().message());
|
||||
}
|
||||
|
@ -275,12 +275,13 @@ Result<size_t> FileUploader::process_part(Part part, NetQueryPtr net_query) {
|
||||
if (net_query->is_error()) {
|
||||
return std::move(net_query->error());
|
||||
}
|
||||
Result<bool> result;
|
||||
if (big_flag_) {
|
||||
result = fetch_result<telegram_api::upload_saveBigFilePart>(net_query->ok());
|
||||
} else {
|
||||
result = fetch_result<telegram_api::upload_saveFilePart>(net_query->ok());
|
||||
}
|
||||
Result<bool> result = [&] {
|
||||
if (big_flag_) {
|
||||
return fetch_result<telegram_api::upload_saveBigFilePart>(net_query->ok());
|
||||
} else {
|
||||
return fetch_result<telegram_api::upload_saveFilePart>(net_query->ok());
|
||||
}
|
||||
}();
|
||||
if (result.is_error()) {
|
||||
return result.move_as_error();
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ class FutureActor final : public Actor {
|
||||
|
||||
private:
|
||||
EventFull event_;
|
||||
Result<T> result_;
|
||||
Result<T> result_ = Status::Error(500, "Empty FutureActor");
|
||||
State state_;
|
||||
|
||||
void set_value(T &&value) {
|
||||
|
@ -23,6 +23,9 @@ class GetHostByNameActor final : public td::Actor {
|
||||
struct Value {
|
||||
Result<td::IPAddress> ip;
|
||||
double expire_at;
|
||||
|
||||
Value(Result<td::IPAddress> ip, double expire_at) : ip(std::move(ip)), expire_at(expire_at) {
|
||||
}
|
||||
};
|
||||
std::unordered_map<string, Value> cache_;
|
||||
static constexpr int32 CACHE_TIME = 60 * 29; // 29 minutes
|
||||
|
@ -610,19 +610,20 @@ Status HttpReader::parse_json_parameters(MutableSlice parameters) {
|
||||
return Status::Error(400, "Bad Request: can't parse object, ':' expected");
|
||||
}
|
||||
parser.skip_whitespaces();
|
||||
Result<MutableSlice> r_value;
|
||||
if (parser.peek_char() == '"') {
|
||||
r_value = json_string_decode(parser);
|
||||
} else {
|
||||
const int32 DEFAULT_MAX_DEPTH = 100;
|
||||
auto begin = parser.ptr();
|
||||
auto result = do_json_skip(parser, DEFAULT_MAX_DEPTH);
|
||||
if (result.is_ok()) {
|
||||
r_value = MutableSlice(begin, parser.ptr());
|
||||
auto r_value = [&]() -> Result<MutableSlice> {
|
||||
if (parser.peek_char() == '"') {
|
||||
return json_string_decode(parser);
|
||||
} else {
|
||||
r_value = result.move_as_error();
|
||||
const int32 DEFAULT_MAX_DEPTH = 100;
|
||||
auto begin = parser.ptr();
|
||||
auto result = do_json_skip(parser, DEFAULT_MAX_DEPTH);
|
||||
if (result.is_ok()) {
|
||||
return MutableSlice(begin, parser.ptr());
|
||||
} else {
|
||||
return result.move_as_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}();
|
||||
if (r_value.is_error()) {
|
||||
return Status::Error(400,
|
||||
string("Bad Request: can't parse parameter value: ") + r_value.error().message().c_str());
|
||||
|
Reference in New Issue
Block a user