diff --git a/CMakeLists.txt b/CMakeLists.txt index 37c2a871..0f160079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ if (EXIV2_TEAM_PACKAGING) endif() configure_file(cmake/exiv2.pc.in exiv2.pc @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # ****************************************************************************** # Man page diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index b5652cc8..917073f2 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -12,9 +12,6 @@ // Define if you require webready support. #cmakedefine EXV_ENABLE_WEBREADY -// Define if you have the `gmtime_r' function. -#cmakedefine EXV_HAVE_GMTIME_R - // Define if you have the header file. #cmakedefine EXV_HAVE_LIBINTL_H diff --git a/cmake/mainSetup.cmake b/cmake/mainSetup.cmake index 1f8d10c8..5bcc3fa5 100644 --- a/cmake/mainSetup.cmake +++ b/cmake/mainSetup.cmake @@ -27,5 +27,8 @@ if (UNIX) endif() endif() -configure_file(cmake/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) -add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") +# Prevent conflicts when exiv2 is consumed in multiple-subdirectory projects. +if (NOT TARGET uninstall) + configure_file(cmake/exiv2_uninstall.cmake ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COPYONLY) + add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") +endif() diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 863c3089..aefaf22e 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -910,13 +910,7 @@ namespace Exiv2 { ULongValue v; v.read(ciffComponent.pData(), 8, byteOrder); time_t t = v.value_[0]; -#ifdef EXV_HAVE_GMTIME_R - struct tm tms; - struct tm* tm = &tms; - tm = gmtime_r(&t, tm); -#else - struct tm* tm = std::gmtime(&t); -#endif + struct tm* tm = std::localtime(&t); if (tm) { const size_t m = 20; char s[m]; @@ -1138,8 +1132,9 @@ namespace Exiv2 { if (ed != image.exifData().end()) { struct tm tm; std::memset(&tm, 0x0, sizeof(tm)); - int rc = exifTime(ed->toString().c_str(), &tm); - if (rc == 0) t = timegm(&tm); + if ( exifTime(ed->toString().c_str(), &tm) == 0 ) { + t=::mktime(&tm); + } } if (t != 0) { DataBuf buf(12); diff --git a/src/version.cpp b/src/version.cpp index 4c32da5d..0cd62c40 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -317,7 +317,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) "unknown"; #endif - int have_gmtime_r =0; int have_inttypes =0; int have_libintl =0; int have_lensdata =0; @@ -352,10 +351,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int use_curl =0; int use_ssh =0; -#ifdef EXV_HAVE_GMTIME_R - have_gmtime_r=1; -#endif - #ifdef EXV_HAVE_INTTYPES_H have_inttypes=1; #endif @@ -524,7 +519,6 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) } output(os,keys,"have_strerror_r" ,have_strerror_r ); - output(os,keys,"have_gmtime_r" ,have_gmtime_r ); output(os,keys,"have_inttypes" ,have_inttypes ); output(os,keys,"have_libintl" ,have_libintl ); output(os,keys,"have_lensdata" ,have_lensdata ); diff --git a/test/crw-test.sh b/test/crw-test.sh index 6b329bd7..d5d9ec21 100755 --- a/test/crw-test.sh +++ b/test/crw-test.sh @@ -14,7 +14,9 @@ source ./functions.source echo set Exif.Canon.SerialNumber 1 echo add Exif.Canon.SerialNumber 2 echo set Exif.Photo.ISOSpeedRatings 155 - # echo set Exif.Photo.DateTimeOriginal 2007:11:11 09:10:11 # See #1219 + echo set Exif.Photo.DateTimeOriginal 2007:11:11 09:10:11 + echo set Exif.Image.DateTime 2020:05:26 07:31:41 + echo set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 ) > $cmdfile copyTestFile $crwfile diff --git a/test/data/crw-test.out b/test/data/crw-test.out index 892c50d3..1d1401a8 100644 --- a/test/data/crw-test.out +++ b/test/data/crw-test.out @@ -6,7 +6,7 @@ Exif.Photo.PixelXDimension Long 1 2272 Exif.Photo.PixelYDimension Long 1 1704 Exif.Image.Orientation Short 1 top, left Exif.Canon.FileNumber Long 1 130-3050 -Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 17:54:36 +Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 18:54:36 Exif.Canon.ImageType Ascii 30 CRW:High definition CCD image Exif.Canon.OwnerName Ascii 15 Andreas Huggel Exif.Image.Make Ascii 6 Canon @@ -72,6 +72,9 @@ Set Exif.Canon.FirmwareVersion "Whatever version" (Ascii) Set Exif.Canon.SerialNumber "1" (Long) Add Exif.Canon.SerialNumber "2" (Long) Set Exif.Photo.ISOSpeedRatings "155" (Short) +Set Exif.Photo.DateTimeOriginal "2007:11:11 09:10:11" (Ascii) +Set Exif.Image.DateTime "2020:05:26 07:31:41" (Ascii) +Set Exif.Photo.DateTimeDigitized "2020:05:26 07:31:42" (Ascii) File 1/1: exiv2-canon-powershot-s40.crw Exif.Thumbnail.Compression Short 1 JPEG (old-style) Exif.Thumbnail.JPEGInterchangeFormat Long 1 0 @@ -80,7 +83,7 @@ Exif.Photo.PixelXDimension Long 1 2272 Exif.Photo.PixelYDimension Long 1 1704 Exif.Image.Orientation Short 1 top, left Exif.Canon.FileNumber Long 1 130-3050 -Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 17:54:36 +Exif.Photo.DateTimeOriginal Ascii 20 2007:11:11 09:10:11 Exif.Canon.ImageType Ascii 30 CRW:High definition CCD image Exif.Canon.OwnerName Ascii 16 Different owner Exif.Image.Make Ascii 6 Canon @@ -117,7 +120,7 @@ Exif.Photo.PixelXDimension Long 1 2272 Exif.Photo.PixelYDimension Long 1 1704 Exif.Image.Orientation Short 1 top, left Exif.Canon.FileNumber Long 1 130-3050 -Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 17:54:36 +Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 18:54:36 Exif.Canon.ImageType Ascii 30 CRW:High definition CCD image Exif.Canon.OwnerName Ascii 15 Andreas Huggel Exif.Image.Make Ascii 6 Canon @@ -186,7 +189,7 @@ Exif.Photo.PixelXDimension Long 1 2272 Exif.Photo.PixelYDimension Long 1 1704 Exif.Image.Orientation Short 1 top, left Exif.Canon.FileNumber Long 1 130-3050 -Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 17:54:36 +Exif.Photo.DateTimeOriginal Ascii 20 2005:04:23 18:54:36 Exif.Canon.ImageType Ascii 30 CRW:High definition CCD image Exif.Image.Make Ascii 6 Canon Exif.Image.Model Ascii 20 Canon PowerShot S40