From 206a2c495c2e30ef760e0f6e83d05bf3c452810f Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Wed, 14 Apr 2021 16:21:50 +0100 Subject: [PATCH] fix_enableBMFF_v1 --- CMakeLists.txt | 2 +- README.md | 4 ++-- include/exiv2/exiv2.hpp | 2 -- src/CMakeLists.txt | 8 +++----- src/bmffimage.cpp | 21 ++++++++++++++------- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf5b912..51d33e8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo (WEBREADY)" OFF ) option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)" OFF ) -option( EXIV2_ENABLE_BMFF "Build with BMFF support" OFF ) +option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON ) option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) diff --git a/README.md b/README.md index ce6a2ba1..af5d02ba 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF ) option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) ... -option( EXIV2_ENABLE_BMFF "Build with BMFF support" OFF ) +option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON ) 577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $ ``` @@ -786,7 +786,7 @@ Access to the bmff code is guarded in two ways. Firstly, you have to build the EXIV2API bool enableBMFF(bool enable); ``` -The return value from `enableBMFF()` reports the current status of bmff support before calling this function. +The return value from `enableBMFF()` is true if the library has been build with bmff support (cmake option -DEXIV2_ANABLE_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. diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp index 60d76b94..e4fad973 100644 --- a/include/exiv2/exiv2.hpp +++ b/include/exiv2/exiv2.hpp @@ -44,9 +44,7 @@ #include "exiv2/mrwimage.hpp" #include "exiv2/orfimage.hpp" #include "exiv2/pgfimage.hpp" -#ifdef EXV_ENABLE_BMFF #include "bmffimage.hpp" -#endif #ifdef EXV_HAVE_LIBZ #include "exiv2/pngimage.hpp" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c102f78a..e89ca8f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,11 +117,9 @@ if( EXIV2_ENABLE_VIDEO ) ) endif() -if( EXIV2_ENABLE_BMFF ) - target_sources(exiv2lib PRIVATE - bmffimage.cpp ../include/exiv2/bmffimage.hpp - ) -endif() +target_sources(exiv2lib PRIVATE + bmffimage.cpp ../include/exiv2/bmffimage.hpp +) # Other library target properties # --------------------------------------------------------- diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index 06f6c2eb..86e9be9c 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -84,18 +84,15 @@ struct BmffBoxHeader // ***************************************************************************** // class member definitions +#ifdef EXV_ENABLE_BMFF namespace Exiv2 { - static bool enabled = false; - -#ifdef EXV_ENABLE_BMFF + static bool enabled = false; EXIV2API bool enableBMFF(bool enable) { - bool result = enabled; - enabled = enable ; - return result ; + enabled = enable ; + return true ; } -#endif // EXV_ENABLE_BMFF std::string Iloc::toString() const { @@ -629,3 +626,13 @@ namespace Exiv2 return matched; } } // namespace Exiv2 +#else // ifdef EXV_ENABLE_BMFF +namespace Exiv2 +{ + EXIV2API bool enableBMFF(bool) + { + return false ; + } +} +#endif +