Skip to content

Commit

Permalink
Fix compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse committed Feb 18, 2022
1 parent 90aa007 commit 5db9a25
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
30 changes: 15 additions & 15 deletions src/pentaxmn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,11 +1175,11 @@ namespace Exiv2 {
return os;
}
const uint32_t date =
(dateIt->toInt64(0) << 24) + (dateIt->toInt64(1) << 16) +
(dateIt->toInt64(2) << 8) + (dateIt->toInt64(3) << 0);
(dateIt->toUint32(0) << 24) + (dateIt->toUint32(1) << 16) +
(dateIt->toUint32(2) << 8) + (dateIt->toUint32(3) << 0);
const uint32_t time =
(timeIt->toInt64(0) << 24) + (timeIt->toInt64(1) << 16) +
(timeIt->toInt64(2) << 8);
(timeIt->toUint32(0) << 24) + (timeIt->toUint32(1) << 16) +
(timeIt->toUint32(2) << 8);
const uint32_t countEnc =
(value.toUint32(0) << 24) + (value.toUint32(1) << 16) +
(value.toUint32(2) << 8) + (value.toUint32(3) << 0);
Expand Down Expand Up @@ -1276,29 +1276,29 @@ namespace Exiv2 {
// 0x0207 Pentax LensInfo Undefined 36 3 255 0 0 40 148 71 152 80 6 241 65 237 153 88 36 1 76 107 251 255 255 255 0 0 80 6 241 0 0 0 0 0 0 0 0
unsigned long base = 1;

unsigned int autoAperture = lensInfo->toInt64(base+1) & 0x01 ;
unsigned int minAperture = lensInfo->toInt64(base+2) & 0x06 ;
unsigned int minFocusDistance = lensInfo->toInt64(base+3) & 0xf8 ;
unsigned int autoAperture = lensInfo->toUint32(base+1) & 0x01 ;
unsigned int minAperture = lensInfo->toUint32(base+2) & 0x06 ;
unsigned int minFocusDistance = lensInfo->toUint32(base+3) & 0xf8 ;

if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+4) == 148) index = 8;
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+5) == 110) index = 7;
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toInt64(base+4) == 110) index = 7;
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toUint32(base+4) == 148) index = 8;
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toUint32(base+5) == 110) index = 7;
if ( autoAperture == 0x0 && minAperture == 0x0 && minFocusDistance == 0x28 && lensInfo->toUint32(base+4) == 110) index = 7;

} else if ( value.count() == 3 ) {
// http://dev.exiv2.org/attachments/download/858/_IGP9032.DNG
// $ exiv2 -pv --grep Lens ~/Downloads/_IGP9032.DNG
// 0x003f PentaxDng LensType Byte 3 3 255 0
// 0x0207 PentaxDng LensInfo Undefined 69 131 0 0 255 0 40 148 68 244 ...
// 0 1 2 3 4 5 6
if ( lensInfo->toInt64(4) == 0 && lensInfo->toInt64(5) == 40 && lensInfo->toInt64(6) == 148 ) index = 8;
if ( lensInfo->toUint32(4) == 0 && lensInfo->toUint32(5) == 40 && lensInfo->toUint32(6) == 148 ) index = 8;

} else if ( value.count() == 4 ) {
// http://dev.exiv2.org/attachments/download/868/IMGP2221.JPG
// 0x0207 PentaxDng LensInfo Undefined 128 0 131 128 0 0 255 1 184 0 0 0 0 0
// 0 1 2 3 4 5 6
if ( lensInfo->count() == 128 && lensInfo->toInt64(1) == 131 && lensInfo->toInt64(2) == 128 ) index = 8;
if ( lensInfo->count() == 128 && lensInfo->toUint32(1) == 131 && lensInfo->toUint32(2) == 128 ) index = 8;
// #1155
if ( lensInfo->toInt64(6) == 5 ) index = 7;
if ( lensInfo->toUint32(6) == 5 ) index = 7;
}

if ( index > 0 ) {
Expand All @@ -1323,7 +1323,7 @@ namespace Exiv2 {
const auto lensInfo = findLensInfo(metadata);
if ( value.count() == 4 ) {
std::string model = getKeyString("Exif.Image.Model" ,metadata);
if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toInt64(1) == 168 && lensInfo->toInt64(2) == 144 ) index = 7;
if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toUint32(1) == 168 && lensInfo->toUint32(2) == 144 ) index = 7;
}

if ( index > 0 ) {
Expand All @@ -1348,7 +1348,7 @@ namespace Exiv2 {
const auto lensInfo = findLensInfo(metadata);
if ( value.count() == 4 ) {
std::string model = getKeyString("Exif.Image.Model" ,metadata);
if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toInt64(1) == 131 && lensInfo->toInt64(2) == 128 )
if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toUint32(1) == 131 && lensInfo->toUint32(2) == 128 )
index = 6;
}
if ( value.count() == 2 ) {
Expand Down
16 changes: 8 additions & 8 deletions src/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,21 +522,21 @@ namespace {
const ExifData &exifData = image_.exifData();
auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_));
if (pos != exifData.end() && pos->count() > 0) {
offset_ = pos->toInt64();
offset_ = pos->toUint32();
}

size_ = 0;
pos = exifData.findKey(ExifKey(param_[parIdx].sizeKey_));
if (pos != exifData.end() && pos->count() > 0) {
size_ = pos->toInt64();
size_ = pos->toUint32();
}

if (offset_ == 0 || size_ == 0) return;

if (param_[parIdx].baseOffsetKey_) {
pos = exifData.findKey(ExifKey(param_[parIdx].baseOffsetKey_));
if (pos != exifData.end() && pos->count() > 0) {
offset_ += pos->toInt64();
offset_ += pos->toUint32();
}
}

Expand Down Expand Up @@ -712,19 +712,19 @@ namespace {
if (pos == exifData.end()) return;
if (offsetCount != pos->value().count()) return;
for (int i = 0; i < offsetCount; i++) {
size_ += pos->toInt64(i);
size_ += pos->toUint32(i);
}

if (size_ == 0) return;

pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageWidth"));
if (pos != exifData.end() && pos->count() > 0) {
width_ = pos->toInt64();
width_ = pos->toUint32();
}

pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageLength"));
if (pos != exifData.end() && pos->count() > 0) {
height_ = pos->toInt64();
height_ = pos->toUint32();
}

if (width_ == 0 || height_ == 0) return;
Expand Down Expand Up @@ -852,8 +852,8 @@ namespace {

if (formatDatum->toString() != "JPEG") return;

width_ = widthDatum->toInt64();
height_ = heightDatum->toInt64();
width_ = widthDatum->toUint32();
height_ = heightDatum->toUint32();
preview_ = decodeBase64(imageDatum->toString());
size_ = static_cast<uint32_t>(preview_.size());
valid_ = true;
Expand Down
2 changes: 1 addition & 1 deletion src/tiffvisitor_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ namespace Exiv2 {
uint32_t sizeTotal = 0;
object->strips_.clear();
for (long i = 0; i < pos->count(); ++i) {
uint32_t len = pos->toInt64(i);
uint32_t len = pos->toUint32(i);
object->strips_.emplace_back(zero, len);
sizeTotal += len;
}
Expand Down

0 comments on commit 5db9a25

Please sign in to comment.