Path: blob/main/astro/gpscorrelate/files/patch-exif-gps.cpp
16461 views
--- exif-gps.cpp.orig 2012-08-14 10:11:01 UTC1+++ exif-gps.cpp2@@ -40,10 +40,8 @@3#include <sys/stat.h>4#include <unistd.h>56+#include <exiv2/exiv2.hpp>78-#include "exiv2/image.hpp"9-#include "exiv2/exif.hpp"10-11#include "gpsstructure.h"12#include "exif-gps.h"1314@@ -87,7 +85,7 @@ char* ReadExifDate(char* File, int* IncludesGPS)15{16// Open and read the file.17Exiv2::ExifData ExifRead;18- Exiv2::Image::AutoPtr Image;19+ Exiv2::Image::UniquePtr Image;2021try {22Image = Exiv2::ImageFactory::open(File);23@@ -150,7 +148,7 @@ char* ReadExifData(char* File, double* Lat, double* Lo24// for display purposes. For the GUI version.25// Open and read the file.26Exiv2::ExifData ExifRead;27- Exiv2::Image::AutoPtr Image;28+ Exiv2::Image::UniquePtr Image;2930try {31Image = Exiv2::ImageFactory::open(File);32@@ -268,7 +266,7 @@ char* ReadExifData(char* File, double* Lat, double* Lo3334// Is the altitude below sea level? If so, negate the value.35GPSData = ExifRead["Exif.GPSInfo.GPSAltitudeRef"];36- if (GPSData.count() >= 1 && GPSData.toLong() == 1)37+ if (GPSData.count() >= 1 && GPSData.toInt64() == 1)38{39// Negate the elevation.40*Elev = -*Elev;41@@ -289,7 +287,7 @@ char* ReadGPSTimestamp(char* File, char* DateStamp, ch42// for display purposes. For the GUI version.43// Open and read the file.44Exiv2::ExifData ExifRead;45- Exiv2::Image::AutoPtr Image;46+ Exiv2::Image::UniquePtr Image;4748try {49Image = Exiv2::ImageFactory::open(File);50@@ -445,7 +443,7 @@ int WriteGPSData(char* File, struct GPSPoint* Point, c51struct utimbuf utb;52if (NoChangeMtime)53stat(File, &statbuf);54- Exiv2::Image::AutoPtr Image;55+ Exiv2::Image::UniquePtr Image;5657try {58Image = Exiv2::ImageFactory::open(File);59@@ -473,7 +471,7 @@ int WriteGPSData(char* File, struct GPSPoint* Point, c60// Do all the easy constant ones first.61// GPSVersionID tag: standard says is should be four bytes: 02 00 00 0062// (and, must be present).63- Exiv2::Value::AutoPtr Value = Exiv2::Value::create(Exiv2::unsignedByte);64+ Exiv2::Value::UniquePtr Value = Exiv2::Value::create(Exiv2::unsignedByte);65Value->read("2 0 0 0");66ExifToWrite.add(Exiv2::ExifKey("Exif.GPSInfo.GPSVersionID"), Value.get());67// Datum: the datum of the measured data. If not given, we insert WGS-84.68@@ -660,7 +658,7 @@ int WriteFixedDatestamp(char* File, time_t Time)69struct utimbuf utb;70stat(File, &statbuf);7172- Exiv2::Image::AutoPtr Image;73+ Exiv2::Image::UniquePtr Image;7475try {76Image = Exiv2::ImageFactory::open(File);77@@ -699,7 +697,7 @@ int WriteFixedDatestamp(char* File, time_t Time)7879char ScratchBuf[100];8081- Exiv2::Value::AutoPtr Value;82+ Exiv2::Value::UniquePtr Value;83Value = Exiv2::Value::create(Exiv2::signedRational);84snprintf(ScratchBuf, 100, "%d/1 %d/1 %d/1",85TimeStamp.tm_year + 1900,86@@ -737,7 +735,7 @@ int RemoveGPSExif(char* File, int NoChangeMtime)87stat(File, &statbuf);8889// Open the file and start reading.90- Exiv2::Image::AutoPtr Image;91+ Exiv2::Image::UniquePtr Image;9293try {94Image = Exiv2::ImageFactory::open(File);959697