Validate.pm (Image-ExifTool-12.57) | : | Validate.pm (Image-ExifTool-12.58) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
# existing ExifTool code while reducing the possibility of | # existing ExifTool code while reducing the possibility of | |||
# introducing bugs or slowing down processing when this feature | # introducing bugs or slowing down processing when this feature | |||
# is not used. | # is not used. | |||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | |||
package Image::ExifTool::Validate; | package Image::ExifTool::Validate; | |||
use strict; | use strict; | |||
use vars qw($VERSION %exifSpec); | use vars qw($VERSION %exifSpec); | |||
$VERSION = '1.19'; | $VERSION = '1.20'; | |||
use Image::ExifTool qw(:Utils); | use Image::ExifTool qw(:Utils); | |||
use Image::ExifTool::Exif; | use Image::ExifTool::Exif; | |||
# EXIF table tag ID's which are part of the EXIF 2.32 specification | # EXIF table tag ID's which are part of the EXIF 2.32 specification | |||
# (with ExifVersion numbers for tags where I can determine the version) | # (with ExifVersion numbers for tags where I can determine the version) | |||
# (also used by BuildTagLookup to add underlines in HTML version of EXIF Tag Tab le) | # (also used by BuildTagLookup to add underlines in HTML version of EXIF Tag Tab le) | |||
%exifSpec = ( | %exifSpec = ( | |||
0x1 => 210, | 0x1 => 210, | |||
0x100 => 1, 0x8298 => 1, 0x9207 => 1, 0xa217 => 1, | 0x100 => 1, 0x8298 => 1, 0x9207 => 1, 0xa217 => 1, | |||
skipping to change at line 440 | skipping to change at line 440 | |||
{ | { | |||
$et->Warn(sprintf('Non-standard format (%s) for %s 0x%.4x %s', $ formatStr, $ifd, $tag, $$ti{Name})) | $et->Warn(sprintf('Non-standard format (%s) for %s 0x%.4x %s', $ formatStr, $ifd, $tag, $$ti{Name})) | |||
} | } | |||
} elsif ($stdFormatAnyIFD{$tag}) { | } elsif ($stdFormatAnyIFD{$tag}) { | |||
if ($$ti{Writable} || $$ti{WriteGroup}) { | if ($$ti{Writable} || $$ti{WriteGroup}) { | |||
my $wgp = $$ti{WriteGroup} || $$tagTablePtr{WRITE_GROUP}; | my $wgp = $$ti{WriteGroup} || $$tagTablePtr{WRITE_GROUP}; | |||
if ($wgp and $wgp ne $ifd) { | if ($wgp and $wgp ne $ifd) { | |||
$et->Warn(sprintf('Wrong IFD for 0x%.4x %s (should be %s not %s)', $tag, $$ti{Name}, $wgp, $ifd)); | $et->Warn(sprintf('Wrong IFD for 0x%.4x %s (should be %s not %s)', $tag, $$ti{Name}, $wgp, $ifd)); | |||
} | } | |||
} | } | |||
} elsif (not $otherSpec{$$et{VALUE}{FileType}} or | } elsif (not $otherSpec{$$et{FileType}} or | |||
(not $otherSpec{$$et{VALUE}{FileType}}{$tag} and not $otherSpec{$$et | (not $otherSpec{$$et{FileType}}{$tag} and not $otherSpec{$$et{FileTy | |||
{VALUE}{FileType}}{All})) | pe}}{All})) | |||
{ | { | |||
if ($tagTablePtr eq \%Image::ExifTool::Exif::Main or $$tagInfo{Unkno wn}) { | if ($tagTablePtr eq \%Image::ExifTool::Exif::Main or $$tagInfo{Unkno wn}) { | |||
$et->Warn(sprintf('Non-standard %s tag 0x%.4x %s', $ifd, $tag, $ $ti{Name}), 1); | $et->Warn(sprintf('Non-standard %s tag 0x%.4x %s', $ifd, $tag, $ $ti{Name}), 1); | |||
} | } | |||
} | } | |||
# change expected count from read Format to Writable size | # change expected count from read Format to Writable size | |||
my $tiCount = $$ti{Count}; | my $tiCount = $$ti{Count}; | |||
if ($tiCount) { | if ($tiCount) { | |||
if ($$ti{Format} and $$ti{Writable} and | if ($$ti{Format} and $$ti{Writable} and | |||
$Image::ExifTool::Exif::formatNumber{$$ti{Format}} and | $Image::ExifTool::Exif::formatNumber{$$ti{Format}} and | |||
$Image::ExifTool::Exif::formatNumber{$$ti{Writable}}) | $Image::ExifTool::Exif::formatNumber{$$ti{Writable}}) | |||
{ | { | |||
my $s1 = $Image::ExifTool::Exif::formatSize[$Image::ExifTool::Ex if::formatNumber{$$ti{Format}}]; | my $s1 = $Image::ExifTool::Exif::formatSize[$Image::ExifTool::Ex if::formatNumber{$$ti{Format}}]; | |||
my $s2 = $Image::ExifTool::Exif::formatSize[$Image::ExifTool::Ex if::formatNumber{$$ti{Writable}}]; | my $s2 = $Image::ExifTool::Exif::formatSize[$Image::ExifTool::Ex if::formatNumber{$$ti{Writable}}]; | |||
$tiCount = int($tiCount * $s1 / $s2); | $tiCount = int($tiCount * $s1 / $s2); | |||
} | } | |||
if ($tiCount > 0 and $count != $tiCount) { | if ($tiCount > 0 and $count != $tiCount) { | |||
$et->Warn(sprintf('Non-standard count (%d) for %s 0x%.4x %s', $c ount, $ifd, $tag, $$ti{Name})); | $et->Warn(sprintf('Non-standard count (%d) for %s 0x%.4x %s', $c ount, $ifd, $tag, $$ti{Name})); | |||
} | } | |||
} | } | |||
} elsif (not $otherSpec{$$et{VALUE}{FileType}} or | } elsif (not $otherSpec{$$et{FileType}} or | |||
(not $otherSpec{$$et{VALUE}{FileType}}{$tag} and not $otherSpec{$$et{VAL | (not $otherSpec{$$et{FileType}}{$tag} and not $otherSpec{$$et{FileType}} | |||
UE}{FileType}}{All})) | {All})) | |||
{ | { | |||
$et->Warn(sprintf('Unknown %s tag 0x%.4x', $ifd, $tag), 1); | $et->Warn(sprintf('Unknown %s tag 0x%.4x', $ifd, $tag), 1); | |||
} | } | |||
} | } | |||
#------------------------------------------------------------------------------ | #------------------------------------------------------------------------------ | |||
# Validate image data offsets/sizes | # Validate image data offsets/sizes | |||
# Inputs: 0) ExifTool ref, 1) offset info hash ref (arrays of tagInfo/value pair s, keyed by tagID) | # Inputs: 0) ExifTool ref, 1) offset info hash ref (arrays of tagInfo/value pair s, keyed by tagID) | |||
# 2) directory name, 3) optional flag for minor warning | # 2) directory name, 3) optional flag for minor warning | |||
sub ValidateOffsetInfo($$$;$) | sub ValidateOffsetInfo($$$;$) | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added |