diff --git a/README.md b/README.md index 331065363f..e497f45edb 100644 --- a/README.md +++ b/README.md @@ -736,13 +736,9 @@ int main(int argc, const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(true); -#endif ... } ``` -The use of the _**thread unsafe function**_ Exiv2::enableBMFF(true) is discussed in [Support for BMFF files (e.g., CR3, HEIF, HEIC, AVIF, and JPEG XL)](#BMFF) [TOC](#TOC)
@@ -758,9 +754,6 @@ The exiv2 command-line program and sample applications call the following at the ```cpp Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(true); -#endif ``` [TOC](#TOC) @@ -904,15 +897,7 @@ This is discussed: [https://github.com/Exiv2/exiv2/issues/1230](https://github.c **Attention is drawn to the possibility that BMFF support may be the subject of patent rights. _Exiv2 shall not be held responsible for identifying any or all such patent rights. Exiv2 shall not be held responsible for the legal consequences of the use of this code_.** -Access to the BMFF code is guarded in two ways. Firstly, you have to build the library with the CMake option: `-DEXIV2_ENABLE_BMFF=ON`. Secondly, the application must enable BMFF support at run-time by calling the following function. - -```cpp -EXIV2API bool enableBMFF(bool enable); -``` - -The return value from `enableBMFF()` is true if the library has been build with BMFF support (CMake option -DEXIV2_ENABLE_BMFF=ON). - -Applications may wish to provide a preference setting to enable BMFF support and thereby place the responsibility for the use of this code with the user of the application. +Access to the BMFF code is guarded by the CMake option: `-DEXIV2_ENABLE_BMFF=ON` (enabled by default). [TOC](#TOC)
diff --git a/app/exiv2.cpp b/app/exiv2.cpp index a35ead58c9..11fda3a85b 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -118,9 +118,6 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif #ifdef EXV_ENABLE_NLS setlocale(LC_ALL, ""); diff --git a/fuzz/fuzz-read-print-write.cpp b/fuzz/fuzz-read-print-write.cpp index 53c52095ab..9025cc70dd 100644 --- a/fuzz/fuzz-read-print-write.cpp +++ b/fuzz/fuzz-read-print-write.cpp @@ -10,9 +10,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { Exiv2::DataBuf data_copy(data, size); diff --git a/include/exiv2/bmffimage.hpp b/include/exiv2/bmffimage.hpp index 786f57201b..2af6789683 100644 --- a/include/exiv2/bmffimage.hpp +++ b/include/exiv2/bmffimage.hpp @@ -13,7 +13,7 @@ // ***************************************************************************** // namespace extensions namespace Exiv2 { -EXIV2API bool enableBMFF(bool enable = true); +[[deprecated]] EXIV2API bool enableBMFF(bool enable = true); } // namespace Exiv2 #ifdef EXV_ENABLE_BMFF diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index 272a83f8da..6da09d1067 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -10,9 +10,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/conntest.cpp b/samples/conntest.cpp index 58d5f35735..eb6eac14d2 100644 --- a/samples/conntest.cpp +++ b/samples/conntest.cpp @@ -75,9 +75,6 @@ void curlcon(const std::string& url, bool useHttp1_0 = false) { int main(int argc, const char** argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc < 2) { std::cout << "Usage: " << argv[0] << " url {-http1_0}" << std::endl; diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index fd82d1a917..85b60662e5 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -9,9 +9,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/easyaccess-test.cpp b/samples/easyaccess-test.cpp index 38d9fce9ad..59e04f7c2c 100644 --- a/samples/easyaccess-test.cpp +++ b/samples/easyaccess-test.cpp @@ -64,9 +64,6 @@ int main(int argc, char** argv) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc < 2) { int count = 0; diff --git a/samples/exifcomment.cpp b/samples/exifcomment.cpp index 7689c6b79a..f2043ff4b7 100644 --- a/samples/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -10,9 +10,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/exifdata-test.cpp b/samples/exifdata-test.cpp index b2a8fbc5ac..3de607af53 100644 --- a/samples/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -12,9 +12,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index b5a457fab4..c36836cc49 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -150,9 +150,6 @@ std::string formatXML(Exiv2::ExifData& exifData) { int main(int argc, const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif format_t formats; formats["wolf"] = wolf; diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 8848fae8c0..baad2cb051 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -16,9 +16,6 @@ int main(int argc, char* const argv[]) { setlocale(LC_CTYPE, ".utf8"); Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif const char* prog = argv[0]; if (argc == 1) { diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index a620e4246b..0a1dd5e664 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -8,9 +8,6 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 3) { std::cerr << "Usage: " << argv[0] << " file key\n"; diff --git a/samples/geotag.cpp b/samples/geotag.cpp index d0df9459d7..87d6d36aee 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -690,9 +690,6 @@ bool mySort(const std::string& a, const std::string& b) { int main(int argc, const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif int result = 0; const char* program = argv[0]; diff --git a/samples/getopt-test.cpp b/samples/getopt-test.cpp index 719755b47e..6ee3660446 100644 --- a/samples/getopt-test.cpp +++ b/samples/getopt-test.cpp @@ -73,9 +73,6 @@ class Params : public Util::Getopt { int main(int argc, char** const argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif int n; diff --git a/samples/ini-test.cpp b/samples/ini-test.cpp index 443121cd86..4812bc6b5d 100644 --- a/samples/ini-test.cpp +++ b/samples/ini-test.cpp @@ -16,9 +16,6 @@ Config loaded from : 'initest.ini' version=6, name=Bob Smith, email=bob@smith.co int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif const char* ini = "ini-test.ini"; INIReader reader(ini); diff --git a/samples/iotest.cpp b/samples/iotest.cpp index c743e7ea45..4b2d40ed2a 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -18,9 +18,6 @@ int WriteReadSeek(BasicIo& io); int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc < 4 || argc > 6) { diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index 379b009580..cbae8495e8 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -8,9 +8,6 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index 15b881feae..3c9191a941 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -8,9 +8,6 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index b20af63a19..50a1698024 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -16,9 +16,6 @@ void processModify(const std::string& line, int num, IptcData& iptcData); int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 2) { diff --git a/samples/key-test.cpp b/samples/key-test.cpp index c081aa1b30..ec36731eef 100644 --- a/samples/key-test.cpp +++ b/samples/key-test.cpp @@ -9,9 +9,6 @@ using namespace Exiv2; int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif int tc = 0; int rc = 0; diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 7db0d91005..08f232c869 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -10,9 +10,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 3) { std::cout << "Usage: " << argv[0] << " image datafile\n"; diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index 52de2db10a..a69d5f1789 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -11,9 +11,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif // Handle command line arguments Params params; diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index 270c4aac60..c8df1e53f6 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -11,9 +11,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index 95b43ce43a..05b6f157f6 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -7,9 +7,6 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 2) { diff --git a/samples/path-test.cpp b/samples/path-test.cpp index cfbc4ddc6d..5046a7c49b 100644 --- a/samples/path-test.cpp +++ b/samples/path-test.cpp @@ -16,9 +16,6 @@ namespace fs = std::experimental::filesystem; int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index d843a13a6e..89d983ff60 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -8,9 +8,6 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/remotetest.cpp b/samples/remotetest.cpp index 0ebfb891ab..291f4f7405 100644 --- a/samples/remotetest.cpp +++ b/samples/remotetest.cpp @@ -11,9 +11,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc < 2) { std::cout << "Usage: " << argv[0] << " file {--nocurl | --curl}\n\n"; diff --git a/samples/stringto-test.cpp b/samples/stringto-test.cpp index 01c7cb186d..5b1179a2a5 100644 --- a/samples/stringto-test.cpp +++ b/samples/stringto-test.cpp @@ -39,9 +39,6 @@ static constexpr const char* testcases[] = { int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif std::cout << std::setfill(' '); diff --git a/samples/taglist.cpp b/samples/taglist.cpp index 261b3eb7f5..03049d0acc 100644 --- a/samples/taglist.cpp +++ b/samples/taglist.cpp @@ -9,9 +9,6 @@ using namespace Exiv2; int main(int argc, char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif int rc = EXIT_SUCCESS; std::ostringstream out; diff --git a/samples/tiff-test.cpp b/samples/tiff-test.cpp index 6f801ef998..6fec8fcbd6 100644 --- a/samples/tiff-test.cpp +++ b/samples/tiff-test.cpp @@ -19,9 +19,6 @@ int main(int argc, char* const argv[]) { try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/write-test.cpp b/samples/write-test.cpp index d62c66da23..291ea0dfa9 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -18,9 +18,6 @@ void exifPrint(const ExifData& exifData); int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 3) { diff --git a/samples/write2-test.cpp b/samples/write2-test.cpp index 90b2881af4..707aff188a 100644 --- a/samples/write2-test.cpp +++ b/samples/write2-test.cpp @@ -11,9 +11,6 @@ void print(const std::string& file); int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 2) { diff --git a/samples/xmpdump.cpp b/samples/xmpdump.cpp index 21a07d3ea1..5564c458c7 100644 --- a/samples/xmpdump.cpp +++ b/samples/xmpdump.cpp @@ -7,9 +7,6 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 2) { diff --git a/samples/xmpparse.cpp b/samples/xmpparse.cpp index 5dadf1d213..33b0eda217 100644 --- a/samples/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -7,9 +7,6 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/xmpparser-test.cpp b/samples/xmpparser-test.cpp index 6be8d87b32..00da49bbfa 100644 --- a/samples/xmpparser-test.cpp +++ b/samples/xmpparser-test.cpp @@ -7,9 +7,6 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/xmpprint.cpp b/samples/xmpprint.cpp index 698c7b9f5b..84a71da2a2 100644 --- a/samples/xmpprint.cpp +++ b/samples/xmpprint.cpp @@ -9,9 +9,6 @@ int main(int argc, char** argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif try { if (argc != 2) { diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index e02b3f0684..a5b526815b 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -15,9 +15,6 @@ bool isEqual(float a, float b) { int main() try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif // The XMP property container Exiv2::XmpData xmpData; diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index 67d9cd1427..ee42d9350a 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -66,11 +66,12 @@ enum { // ***************************************************************************** // class member definitions -#ifdef EXV_ENABLE_BMFF namespace Exiv2 { -static bool enabled = false; -bool enableBMFF(bool enable) { - enabled = enable; +bool enableBMFF(bool) { +#ifndef EXV_ENABLE_BMFF + return false; +} +#else return true; } @@ -781,9 +782,6 @@ Image::UniquePtr newBmffInstance(BasicIo::UniquePtr io, bool create) { } bool isBmffType(BasicIo& iIo, bool advance) { - if (!enabled) { - return false; - } const int32_t len = 12; byte buf[len]; iIo.read(buf, len); @@ -802,11 +800,5 @@ bool isBmffType(BasicIo& iIo, bool advance) { } return matched; } +#endif // EXV_ENABLE_BMFF } // namespace Exiv2 -#else // ifdef EXV_ENABLE_BMFF -namespace Exiv2 { -bool enableBMFF(bool) { - return false; -} -} // namespace Exiv2 -#endif