Fix clang-tidy warning about double move.

This commit is contained in:
Kevin Backhouse 2022-07-30 12:16:28 -04:00 committed by Rosen Penev
parent 39239cef68
commit 8ba9003f19

View File

@ -474,8 +474,11 @@ TiffComponent* TiffDirectory::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffCo
return tc->addPath(tag, tiffPath, pRoot, std::move(object));
auto atc = [&] {
if (tiffPath.size() == 1 && object)
return std::move(object);
if (tiffPath.size() == 1 && object) {
TiffComponent::UniquePtr tempObject;
std::swap(object, tempObject);
return tempObject;
}
return TiffCreator::create(tpi.extendedTag(), tpi.group());
}();
@ -508,8 +511,11 @@ TiffComponent* TiffSubIfd::doAddPath(uint16_t tag, TiffPath& tiffPath, TiffCompo
return (*it)->addPath(tag, tiffPath, pRoot, std::move(object));
auto tc = [&] {
if (tiffPath.size() == 1 && object)
return addChild(std::move(object));
if (tiffPath.size() == 1 && object) {
TiffComponent::UniquePtr tempObject;
std::swap(object, tempObject);
return addChild(std::move(tempObject));
}
return addChild(std::make_unique<TiffDirectory>(tpi1.tag(), tpi2.group()));
}();
setCount(ifds_.size());
@ -562,8 +568,11 @@ TiffComponent* TiffBinaryArray::doAddPath(uint16_t tag, TiffPath& tiffPath, Tiff
return (*it)->addPath(tag, tiffPath, pRoot, std::move(object));
auto atc = [&] {
if (tiffPath.size() == 1 && object)
return std::move(object);
if (tiffPath.size() == 1 && object) {
TiffComponent::UniquePtr tempObject;
std::swap(object, tempObject);
return tempObject;
}
return TiffCreator::create(tpi.extendedTag(), tpi.group());
}();
auto tc = addChild(std::move(atc));