Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse committed Sep 24, 2021
1 parent 4a2fe16 commit e2f3c6b
Showing 1 changed file with 58 additions and 58 deletions.
116 changes: 58 additions & 58 deletions src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,68 +855,68 @@ namespace Exiv2 {
XMP_DateTime datetime;
try {
SXMPUtils::ConvertToDate(value, &datetime);
char buf[30];
if (std::string(to) != "Exif.GPSInfo.GPSTimeStamp") {

SXMPUtils::ConvertToLocalTime(&datetime);

snprintf(buf, sizeof(buf), "%4d:%02d:%02d %02d:%02d:%02d",
static_cast<int>(datetime.year),
static_cast<int>(datetime.month),
static_cast<int>(datetime.day),
static_cast<int>(datetime.hour),
static_cast<int>(datetime.minute),
static_cast<int>(datetime.second));
buf[sizeof(buf) - 1] = 0;
(*exifData_)[to] = buf;

if (datetime.nanoSecond) {
const char* subsecTag = 0;
if (std::string(to) == "Exif.Image.DateTime") {
subsecTag = "Exif.Photo.SubSecTime";
}
else if (std::string(to) == "Exif.Photo.DateTimeOriginal") {
subsecTag = "Exif.Photo.SubSecTimeOriginal";
}
else if (std::string(to) == "Exif.Photo.DateTimeDigitized") {
subsecTag = "Exif.Photo.SubSecTimeDigitized";
}
if (subsecTag) {
prepareExifTarget(subsecTag, true);
(*exifData_)[subsecTag] = toString(datetime.nanoSecond);
char buf[30];
if (std::string(to) != "Exif.GPSInfo.GPSTimeStamp") {

SXMPUtils::ConvertToLocalTime(&datetime);

snprintf(buf, sizeof(buf), "%4d:%02d:%02d %02d:%02d:%02d",
static_cast<int>(datetime.year),
static_cast<int>(datetime.month),
static_cast<int>(datetime.day),
static_cast<int>(datetime.hour),
static_cast<int>(datetime.minute),
static_cast<int>(datetime.second));
buf[sizeof(buf) - 1] = 0;
(*exifData_)[to] = buf;

if (datetime.nanoSecond) {
const char* subsecTag = 0;
if (std::string(to) == "Exif.Image.DateTime") {
subsecTag = "Exif.Photo.SubSecTime";
}
else if (std::string(to) == "Exif.Photo.DateTimeOriginal") {
subsecTag = "Exif.Photo.SubSecTimeOriginal";
}
else if (std::string(to) == "Exif.Photo.DateTimeDigitized") {
subsecTag = "Exif.Photo.SubSecTimeDigitized";
}
if (subsecTag) {
prepareExifTarget(subsecTag, true);
(*exifData_)[subsecTag] = toString(datetime.nanoSecond);
}
}
}
}
else { // "Exif.GPSInfo.GPSTimeStamp"

// Ignore the time zone, assuming the time is in UTC as it should be

URational rhour(datetime.hour, 1);
URational rmin(datetime.minute, 1);
URational rsec(datetime.second, 1);
if (datetime.nanoSecond != 0) {
if (datetime.second != 0) {
// Add the seconds to rmin so that the ns fit into rsec
rmin.second = 60;
rmin.first *= 60;
rmin.first += datetime.second;
else { // "Exif.GPSInfo.GPSTimeStamp"

// Ignore the time zone, assuming the time is in UTC as it should be

URational rhour(datetime.hour, 1);
URational rmin(datetime.minute, 1);
URational rsec(datetime.second, 1);
if (datetime.nanoSecond != 0) {
if (datetime.second != 0) {
// Add the seconds to rmin so that the ns fit into rsec
rmin.second = 60;
rmin.first *= 60;
rmin.first += datetime.second;
}
rsec.second = 1000000000;
rsec.first = datetime.nanoSecond;
}
rsec.second = 1000000000;
rsec.first = datetime.nanoSecond;
}

std::ostringstream array;
array << rhour << " " << rmin << " " << rsec;
(*exifData_)[to] = array.str();

prepareExifTarget("Exif.GPSInfo.GPSDateStamp", true);
snprintf(buf, sizeof(buf), "%4d:%02d:%02d",
static_cast<int>(datetime.year),
static_cast<int>(datetime.month),
static_cast<int>(datetime.day));
buf[sizeof(buf) - 1] = 0;
(*exifData_)["Exif.GPSInfo.GPSDateStamp"] = buf;
}
std::ostringstream array;
array << rhour << " " << rmin << " " << rsec;
(*exifData_)[to] = array.str();

prepareExifTarget("Exif.GPSInfo.GPSDateStamp", true);
snprintf(buf, sizeof(buf), "%4d:%02d:%02d",
static_cast<int>(datetime.year),
static_cast<int>(datetime.month),
static_cast<int>(datetime.day));
buf[sizeof(buf) - 1] = 0;
(*exifData_)["Exif.GPSInfo.GPSDateStamp"] = buf;
}
}
#ifndef SUPPRESS_WARNINGS
catch (const XMP_Error& e) {
Expand Down

0 comments on commit e2f3c6b

Please sign in to comment.