diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2023-09-18 20:20:57 +0200 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2023-09-18 20:20:57 +0200 |
commit | 90ae365a532c10534a63e7b5ade9f43512b33964 (patch) | |
tree | f982087829a0e2b3ac8b07af8108e3fee1111d9e | |
parent | b65f43ace8dbf129d441853d1479802d995b1661 (diff) |
fix compilation on NetBSD - by Thomas Klausner
-rw-r--r-- | src/ImageMetaData.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx index 32ba477..fa334aa 100644 --- a/src/ImageMetaData.cxx +++ b/src/ImageMetaData.cxx @@ -101,7 +101,11 @@ exifSetCoordinate(double *destVal, Exiv2::ExifData *exifData, const char *name) int ImageMetaData::load_image_exif(char *name) { - Exiv2::Image::AutoPtr image; +#if EXIV2_TEST_VERSION(0,28,0) + Exiv2::Image::UniquePtr image; +#else + Exiv2::Image::AutoPtr image; +#endif try { image = Exiv2::ImageFactory::open(name); @@ -133,19 +137,19 @@ ImageMetaData::load_image_exif(char *name) { _model = strdup(pos->toString().c_str()); } - if (isnan(_focal_length)) + if (std::isnan(_focal_length)) exifSetValue(&_focal_length, &exifData, "Exif.Photo.FocalLength"); - if (isnan(_focal_length_35mm)) + if (std::isnan(_focal_length_35mm)) exifSetValue(&_focal_length_35mm, &exifData, "Exif.Photo.FocalLengthIn35mmFilm"); - if (isnan(_longitude)) + if (std::isnan(_longitude)) exifSetCoordinate(&_longitude, &exifData, "Exif.GPSInfo.GPSLongitude"); - if (isnan(_latitude)) + if (std::isnan(_latitude)) exifSetCoordinate(&_latitude, &exifData, "Exif.GPSInfo.GPSLatitude"); - if (isnan(_height)) + if (std::isnan(_height)) exifSetValue(&_height, &exifData, "Exif.GPSInfo.GPSAltitude"); return 0; @@ -169,15 +173,19 @@ ImageMetaData::load_image_jpgcom(char *name) { double lo, la, he, dir, ni, ti, fr, k0, k1, x0 = 0.0; int pt = 0; int n, ret = 1; - Exiv2::Image::AutoPtr image; +#if EXIV2_TEST_VERSION(0,28,0) + Exiv2::Image::UniquePtr image; +#else + Exiv2::Image::AutoPtr image; +#endif - try { - image = Exiv2::ImageFactory::open(name); - image->readMetadata(); - } catch (const Exiv2::Error &error) { - fprintf(stderr, "Error reading metadata\n"); - return 1; - } + try { + image = Exiv2::ImageFactory::open(name); + image->readMetadata(); + } catch (const Exiv2::Error &error) { + fprintf(stderr, "Error reading metadata\n"); + return 1; + } const char *com = image->comment().c_str(); @@ -244,7 +252,11 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) { close(in_fd); +#if EXIV2_TEST_VERSION(0,28,0) + Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(tmpname); +#else Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(tmpname); +#endif if (!image.get()) err++; |