diff --git a/src/epsimage.cpp b/src/epsimage.cpp index 2f68f1c1..196e61ce 100644 --- a/src/epsimage.cpp +++ b/src/epsimage.cpp @@ -759,33 +759,16 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList } } if (posEndPhotoshop != posEndEps) { - NativePreview nativePreview; - nativePreview.position_ = static_cast(posBeginPhotoshop); - nativePreview.size_ = static_cast(posEndPhotoshop - posBeginPhotoshop); - nativePreview.width_ = 0; - nativePreview.height_ = 0; - nativePreview.filter_ = "hex-irb"; - nativePreview.mimeType_ = "image/jpeg"; + auto sizePhotoshop = posEndPhotoshop - posBeginPhotoshop; + NativePreview nativePreview{posBeginPhotoshop, sizePhotoshop, 0, 0, "hex-irb", "image/jpeg"}; nativePreviews.push_back(std::move(nativePreview)); } if (sizeWmf != 0) { - NativePreview nativePreview; - nativePreview.position_ = static_cast(posWmf); - nativePreview.size_ = sizeWmf; - nativePreview.width_ = 0; - nativePreview.height_ = 0; - nativePreview.filter_ = ""; - nativePreview.mimeType_ = "image/x-wmf"; + NativePreview nativePreview{posWmf, sizeWmf, 0, 0, "", "image/x-wmf"}; nativePreviews.push_back(std::move(nativePreview)); } if (sizeTiff != 0) { - NativePreview nativePreview; - nativePreview.position_ = static_cast(posTiff); - nativePreview.size_ = sizeTiff; - nativePreview.width_ = 0; - nativePreview.height_ = 0; - nativePreview.filter_ = ""; - nativePreview.mimeType_ = "image/tiff"; + NativePreview nativePreview{posTiff, sizeTiff, 0, 0, "", "image/tiff"}; nativePreviews.push_back(std::move(nativePreview)); } } else { diff --git a/src/psdimage.cpp b/src/psdimage.cpp index fb5431a0..8db01c80 100644 --- a/src/psdimage.cpp +++ b/src/psdimage.cpp @@ -292,13 +292,12 @@ void PsdImage::readResourceBlock(uint16_t resourceId, uint32_t resourceSize) { if (io_->error() || io_->eof()) throw Error(ErrorCode::kerFailedToReadImageData); - if (format == 1) { - nativePreview.filter_ = ""; - nativePreview.mimeType_ = "image/jpeg"; - nativePreviews_.push_back(std::move(nativePreview)); - } else { - // unsupported format of native preview - } + // unsupported format of native preview + if (format != 1) + break; + nativePreview.filter_ = ""; + nativePreview.mimeType_ = "image/jpeg"; + nativePreviews_.push_back(std::move(nativePreview)); } break; } diff --git a/src/xmp.cpp b/src/xmp.cpp index 68abc9d9..99c8103d 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -422,7 +422,7 @@ Xmpdatum& XmpData::operator[](const std::string& key) { XmpKey xmpKey(key); auto pos = findKey(xmpKey); if (pos == end()) { - xmpMetadata_.push_back(Xmpdatum(xmpKey)); + xmpMetadata_.emplace_back(xmpKey); return xmpMetadata_.back(); } return *pos;