Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/add exceptions for BMFF based files #2364

Merged
merged 3 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/exiv2/bmffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ class EXIV2API BmffImage : public Image {
//@{
void readMetadata() override;
void writeMetadata() override;
void setExifData(const ExifData&) override;
void setIptcData(const IptcData&) override;
void setXmpData(const XmpData&) override;
void setComment(const std::string& comment) override;
void printStructure(std::ostream& out, Exiv2::PrintStructureOption option, size_t depth) override;
//@}
Expand Down
14 changes: 13 additions & 1 deletion src/bmffimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,18 @@ void BmffImage::parseCr3Preview(DataBuf& data, std::ostream& out, bool bTrace, u
}
}

void BmffImage::setExifData(const ExifData& /*exifData*/) {
throw(Error(ErrorCode::kerInvalidSettingForImage, "Exif metadata", "BMFF"));
}

void BmffImage::setIptcData(const IptcData& /*iptcData*/) {
throw(Error(ErrorCode::kerInvalidSettingForImage, "IPTC metadata", "BMFF"));
}

void BmffImage::setXmpData(const XmpData& /*xmpData*/) {
throw(Error(ErrorCode::kerInvalidSettingForImage, "XMP metadata", "BMFF"));
}

void BmffImage::setComment(const std::string&) {
// bmff files are read-only
throw(Error(ErrorCode::kerInvalidSettingForImage, "Image comment", "BMFF"));
Expand Down Expand Up @@ -652,7 +664,7 @@ void BmffImage::printStructure(std::ostream& out, Exiv2::PrintStructureOption op

void BmffImage::writeMetadata() {
// bmff files are read-only
throw(Error(ErrorCode::kerInvalidSettingForImage, "Image comment", "BMFF"));
throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "BMFF"));
} // BmffImage::writeMetadata

// *************************************************************************
Expand Down