Fix type of size parameter in set_known_prefix.

This commit is contained in:
levlam 2023-03-08 16:06:08 +03:00
parent 5508285804
commit 17540f1c15
3 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ void FileLoader::update_local_file_location(const LocalFileLocation &local) {
return;
}
auto prefix_info = r_prefix_info.move_as_ok();
auto status = parts_manager_.set_known_prefix(narrow_cast<size_t>(prefix_info.size), prefix_info.is_ready);
auto status = parts_manager_.set_known_prefix(prefix_info.size, prefix_info.is_ready);
if (status.is_error()) {
on_error(std::move(status));
stop_flag_ = true;

View File

@ -310,19 +310,19 @@ Result<Part> PartsManager::start_part() {
return get_part(part_id);
}
Status PartsManager::set_known_prefix(size_t size, bool is_ready) {
Status PartsManager::set_known_prefix(int64 size, bool is_ready) {
if (!known_prefix_flag_ || size < static_cast<size_t>(known_prefix_size_)) {
CHECK(is_upload_);
return Status::Error("FILE_UPLOAD_RESTART");
}
known_prefix_size_ = narrow_cast<int64>(size);
known_prefix_size_ = size;
expected_size_ = max(known_prefix_size_, expected_size_);
CHECK(static_cast<size_t>(part_count_) == part_status_.size());
if (is_ready) {
part_count_ = static_cast<int>(calc_part_count(size, part_size_));
size_ = narrow_cast<int64>(size);
size_ = size;
unknown_size_flag_ = false;
known_prefix_flag_ = false;
} else {

View File

@ -33,7 +33,7 @@ class PartsManager {
Result<Part> start_part() TD_WARN_UNUSED_RESULT;
Status on_part_ok(int part_id, size_t part_size, size_t actual_size) TD_WARN_UNUSED_RESULT;
void on_part_failed(int part_id);
Status set_known_prefix(size_t size, bool is_ready);
Status set_known_prefix(int64 size, bool is_ready);
void set_need_check();
void set_checked_prefix_size(int64 size);
int32 set_streaming_offset(int64 offset, int64 limit);