Use std::move to update document fields.
This commit is contained in:
parent
807d18cefc
commit
a13afd0a93
@ -178,7 +178,7 @@ FileId AnimationsManager::on_get_animation(unique_ptr<Animation> new_animation,
|
|||||||
CHECK(a->file_id == file_id);
|
CHECK(a->file_id == file_id);
|
||||||
if (a->mime_type != new_animation->mime_type) {
|
if (a->mime_type != new_animation->mime_type) {
|
||||||
LOG(DEBUG) << "Animation " << file_id << " info has changed";
|
LOG(DEBUG) << "Animation " << file_id << " info has changed";
|
||||||
a->mime_type = new_animation->mime_type;
|
a->mime_type = std::move(new_animation->mime_type);
|
||||||
}
|
}
|
||||||
if (a->file_name != new_animation->file_name) {
|
if (a->file_name != new_animation->file_name) {
|
||||||
LOG(DEBUG) << "Animation " << file_id << " file name has changed";
|
LOG(DEBUG) << "Animation " << file_id << " file name has changed";
|
||||||
@ -202,7 +202,7 @@ FileId AnimationsManager::on_get_animation(unique_ptr<Animation> new_animation,
|
|||||||
LOG(INFO) << "Animation " << file_id << " thumbnail has changed from " << a->thumbnail << " to "
|
LOG(INFO) << "Animation " << file_id << " thumbnail has changed from " << a->thumbnail << " to "
|
||||||
<< new_animation->thumbnail;
|
<< new_animation->thumbnail;
|
||||||
}
|
}
|
||||||
a->thumbnail = new_animation->thumbnail;
|
a->thumbnail = std::move(new_animation->thumbnail);
|
||||||
}
|
}
|
||||||
if (a->animated_thumbnail != new_animation->animated_thumbnail) {
|
if (a->animated_thumbnail != new_animation->animated_thumbnail) {
|
||||||
if (!a->animated_thumbnail.file_id.is_valid()) {
|
if (!a->animated_thumbnail.file_id.is_valid()) {
|
||||||
@ -211,7 +211,7 @@ FileId AnimationsManager::on_get_animation(unique_ptr<Animation> new_animation,
|
|||||||
LOG(INFO) << "Animation " << file_id << " animated thumbnail has changed from " << a->animated_thumbnail
|
LOG(INFO) << "Animation " << file_id << " animated thumbnail has changed from " << a->animated_thumbnail
|
||||||
<< " to " << new_animation->animated_thumbnail;
|
<< " to " << new_animation->animated_thumbnail;
|
||||||
}
|
}
|
||||||
a->animated_thumbnail = new_animation->animated_thumbnail;
|
a->animated_thumbnail = std::move(new_animation->animated_thumbnail);
|
||||||
}
|
}
|
||||||
if (a->has_stickers != new_animation->has_stickers && new_animation->has_stickers) {
|
if (a->has_stickers != new_animation->has_stickers && new_animation->has_stickers) {
|
||||||
a->has_stickers = new_animation->has_stickers;
|
a->has_stickers = new_animation->has_stickers;
|
||||||
|
@ -101,13 +101,13 @@ FileId AudiosManager::on_get_audio(unique_ptr<Audio> new_audio, bool replace) {
|
|||||||
CHECK(a->file_id == new_audio->file_id);
|
CHECK(a->file_id == new_audio->file_id);
|
||||||
if (a->mime_type != new_audio->mime_type) {
|
if (a->mime_type != new_audio->mime_type) {
|
||||||
LOG(DEBUG) << "Audio " << file_id << " info has changed";
|
LOG(DEBUG) << "Audio " << file_id << " info has changed";
|
||||||
a->mime_type = new_audio->mime_type;
|
a->mime_type = std::move(new_audio->mime_type);
|
||||||
}
|
}
|
||||||
if (a->duration != new_audio->duration || a->title != new_audio->title || a->performer != new_audio->performer) {
|
if (a->duration != new_audio->duration || a->title != new_audio->title || a->performer != new_audio->performer) {
|
||||||
LOG(DEBUG) << "Audio " << file_id << " info has changed";
|
LOG(DEBUG) << "Audio " << file_id << " info has changed";
|
||||||
a->duration = new_audio->duration;
|
a->duration = new_audio->duration;
|
||||||
a->title = new_audio->title;
|
a->title = std::move(new_audio->title);
|
||||||
a->performer = new_audio->performer;
|
a->performer = std::move(new_audio->performer);
|
||||||
}
|
}
|
||||||
if (a->file_name != new_audio->file_name) {
|
if (a->file_name != new_audio->file_name) {
|
||||||
LOG(DEBUG) << "Audio " << file_id << " file name has changed";
|
LOG(DEBUG) << "Audio " << file_id << " file name has changed";
|
||||||
@ -126,7 +126,7 @@ FileId AudiosManager::on_get_audio(unique_ptr<Audio> new_audio, bool replace) {
|
|||||||
LOG(INFO) << "Audio " << file_id << " thumbnail has changed from " << a->thumbnail << " to "
|
LOG(INFO) << "Audio " << file_id << " thumbnail has changed from " << a->thumbnail << " to "
|
||||||
<< new_audio->thumbnail;
|
<< new_audio->thumbnail;
|
||||||
}
|
}
|
||||||
a->thumbnail = new_audio->thumbnail;
|
a->thumbnail = std::move(new_audio->thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,11 +545,11 @@ FileId DocumentsManager::on_get_document(unique_ptr<GeneralDocument> new_documen
|
|||||||
CHECK(d->file_id == new_document->file_id);
|
CHECK(d->file_id == new_document->file_id);
|
||||||
if (d->mime_type != new_document->mime_type) {
|
if (d->mime_type != new_document->mime_type) {
|
||||||
LOG(DEBUG) << "Document " << file_id << " mime_type has changed";
|
LOG(DEBUG) << "Document " << file_id << " mime_type has changed";
|
||||||
d->mime_type = new_document->mime_type;
|
d->mime_type = std::move(new_document->mime_type);
|
||||||
}
|
}
|
||||||
if (d->file_name != new_document->file_name) {
|
if (d->file_name != new_document->file_name) {
|
||||||
LOG(DEBUG) << "Document " << file_id << " file_name has changed";
|
LOG(DEBUG) << "Document " << file_id << " file_name has changed";
|
||||||
d->file_name = new_document->file_name;
|
d->file_name = std::move(new_document->file_name);
|
||||||
}
|
}
|
||||||
if (d->minithumbnail != new_document->minithumbnail) {
|
if (d->minithumbnail != new_document->minithumbnail) {
|
||||||
d->minithumbnail = std::move(new_document->minithumbnail);
|
d->minithumbnail = std::move(new_document->minithumbnail);
|
||||||
@ -561,7 +561,7 @@ FileId DocumentsManager::on_get_document(unique_ptr<GeneralDocument> new_documen
|
|||||||
LOG(INFO) << "Document " << file_id << " thumbnail has changed from " << d->thumbnail << " to "
|
LOG(INFO) << "Document " << file_id << " thumbnail has changed from " << d->thumbnail << " to "
|
||||||
<< new_document->thumbnail;
|
<< new_document->thumbnail;
|
||||||
}
|
}
|
||||||
d->thumbnail = new_document->thumbnail;
|
d->thumbnail = std::move(new_document->thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ FileId VideoNotesManager::on_get_video_note(unique_ptr<VideoNote> new_video_note
|
|||||||
LOG(INFO) << "Video note " << file_id << " thumbnail has changed from " << v->thumbnail << " to "
|
LOG(INFO) << "Video note " << file_id << " thumbnail has changed from " << v->thumbnail << " to "
|
||||||
<< new_video_note->thumbnail;
|
<< new_video_note->thumbnail;
|
||||||
}
|
}
|
||||||
v->thumbnail = new_video_note->thumbnail;
|
v->thumbnail = std::move(new_video_note->thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return file_id;
|
return file_id;
|
||||||
|
@ -63,7 +63,7 @@ FileId VideosManager::on_get_video(unique_ptr<Video> new_video, bool replace) {
|
|||||||
CHECK(v->file_id == new_video->file_id);
|
CHECK(v->file_id == new_video->file_id);
|
||||||
if (v->mime_type != new_video->mime_type) {
|
if (v->mime_type != new_video->mime_type) {
|
||||||
LOG(DEBUG) << "Video " << file_id << " MIME type has changed";
|
LOG(DEBUG) << "Video " << file_id << " MIME type has changed";
|
||||||
v->mime_type = new_video->mime_type;
|
v->mime_type = std::move(new_video->mime_type);
|
||||||
}
|
}
|
||||||
if (v->duration != new_video->duration || v->dimensions != new_video->dimensions ||
|
if (v->duration != new_video->duration || v->dimensions != new_video->dimensions ||
|
||||||
v->supports_streaming != new_video->supports_streaming) {
|
v->supports_streaming != new_video->supports_streaming) {
|
||||||
@ -86,7 +86,7 @@ FileId VideosManager::on_get_video(unique_ptr<Video> new_video, bool replace) {
|
|||||||
LOG(INFO) << "Video " << file_id << " thumbnail has changed from " << v->thumbnail << " to "
|
LOG(INFO) << "Video " << file_id << " thumbnail has changed from " << v->thumbnail << " to "
|
||||||
<< new_video->thumbnail;
|
<< new_video->thumbnail;
|
||||||
}
|
}
|
||||||
v->thumbnail = new_video->thumbnail;
|
v->thumbnail = std::move(new_video->thumbnail);
|
||||||
}
|
}
|
||||||
if (v->animated_thumbnail != new_video->animated_thumbnail) {
|
if (v->animated_thumbnail != new_video->animated_thumbnail) {
|
||||||
if (!v->animated_thumbnail.file_id.is_valid()) {
|
if (!v->animated_thumbnail.file_id.is_valid()) {
|
||||||
@ -95,7 +95,7 @@ FileId VideosManager::on_get_video(unique_ptr<Video> new_video, bool replace) {
|
|||||||
LOG(INFO) << "Video " << file_id << " animated thumbnail has changed from " << v->animated_thumbnail << " to "
|
LOG(INFO) << "Video " << file_id << " animated thumbnail has changed from " << v->animated_thumbnail << " to "
|
||||||
<< new_video->animated_thumbnail;
|
<< new_video->animated_thumbnail;
|
||||||
}
|
}
|
||||||
v->animated_thumbnail = new_video->animated_thumbnail;
|
v->animated_thumbnail = std::move(new_video->animated_thumbnail);
|
||||||
}
|
}
|
||||||
if (v->has_stickers != new_video->has_stickers && new_video->has_stickers) {
|
if (v->has_stickers != new_video->has_stickers && new_video->has_stickers) {
|
||||||
v->has_stickers = new_video->has_stickers;
|
v->has_stickers = new_video->has_stickers;
|
||||||
|
@ -168,12 +168,12 @@ FileId VoiceNotesManager::on_get_voice_note(unique_ptr<VoiceNote> new_voice_note
|
|||||||
CHECK(v->file_id == new_voice_note->file_id);
|
CHECK(v->file_id == new_voice_note->file_id);
|
||||||
if (v->mime_type != new_voice_note->mime_type) {
|
if (v->mime_type != new_voice_note->mime_type) {
|
||||||
LOG(DEBUG) << "Voice note " << file_id << " info has changed";
|
LOG(DEBUG) << "Voice note " << file_id << " info has changed";
|
||||||
v->mime_type = new_voice_note->mime_type;
|
v->mime_type = std::move(new_voice_note->mime_type);
|
||||||
}
|
}
|
||||||
if (v->duration != new_voice_note->duration || v->waveform != new_voice_note->waveform) {
|
if (v->duration != new_voice_note->duration || v->waveform != new_voice_note->waveform) {
|
||||||
LOG(DEBUG) << "Voice note " << file_id << " info has changed";
|
LOG(DEBUG) << "Voice note " << file_id << " info has changed";
|
||||||
v->duration = new_voice_note->duration;
|
v->duration = new_voice_note->duration;
|
||||||
v->waveform = new_voice_note->waveform;
|
v->waveform = std::move(new_voice_note->waveform);
|
||||||
}
|
}
|
||||||
if (new_voice_note->is_transcribed && v->transcription_id == 0) {
|
if (new_voice_note->is_transcribed && v->transcription_id == 0) {
|
||||||
CHECK(!v->is_transcribed);
|
CHECK(!v->is_transcribed);
|
||||||
|
Loading…
Reference in New Issue
Block a user