diff options
-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++; |