"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Image/ExifTool/FlashPix.pm" between
Image-ExifTool-12.26.tar.gz and Image-ExifTool-12.27.tar.gz

About: ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in a wide variety of files.

FlashPix.pm  (Image-ExifTool-12.26):FlashPix.pm  (Image-ExifTool-12.27)
skipping to change at line 24 skipping to change at line 24
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
package Image::ExifTool::FlashPix; package Image::ExifTool::FlashPix;
use strict; use strict;
use vars qw($VERSION); use vars qw($VERSION);
use Image::ExifTool qw(:DataAccess :Utils); use Image::ExifTool qw(:DataAccess :Utils);
use Image::ExifTool::Exif; use Image::ExifTool::Exif;
use Image::ExifTool::ASF; # for GetGUID() use Image::ExifTool::ASF; # for GetGUID()
$VERSION = '1.38'; $VERSION = '1.39';
sub ProcessFPX($$); sub ProcessFPX($$);
sub ProcessFPXR($$$); sub ProcessFPXR($$$);
sub ProcessProperties($$$); sub ProcessProperties($$$);
sub ReadFPXValue($$$$$;$$); sub ReadFPXValue($$$$$;$$);
sub ProcessHyperlinks($$); sub ProcessHyperlinks($$);
sub ProcessContents($$$); sub ProcessContents($$$);
sub ProcessWordDocument($$$); sub ProcessWordDocument($$$);
sub ProcessDocumentTable($); sub ProcessDocumentTable($);
sub ProcessCommentBy($$$); sub ProcessCommentBy($$$);
skipping to change at line 1372 skipping to change at line 1372
my ($et, $dataPt, $valPos, $type, $dirEnd, $noPad, $codePage) = @_; my ($et, $dataPt, $valPos, $type, $dirEnd, $noPad, $codePage) = @_;
my @vals; my @vals;
my $format = $oleFormat{$type & 0x0fff}; my $format = $oleFormat{$type & 0x0fff};
while ($format) { while ($format) {
my $count = 1; my $count = 1;
# handle VT_VECTOR types # handle VT_VECTOR types
my $flags = $type & 0xf000; my $flags = $type & 0xf000;
if ($flags) { if ($flags) {
if ($flags == VT_VECTOR) { if ($flags == VT_VECTOR) {
$noPad = 1; # values don't seem to be padded inside vectors $noPad = 1; # values sometimes aren't padded inside vectors! !
my $size = $oleFormatSize{VT_VECTOR}; my $size = $oleFormatSize{VT_VECTOR};
last if $valPos + $size > $dirEnd; if ($valPos + $size > $dirEnd) {
$et->WarnOnce('Incorrect FPX VT_VECTOR size');
last;
}
$count = Get32u($dataPt, $valPos); $count = Get32u($dataPt, $valPos);
push @vals, '' if $count == 0; # allow zero-element vector push @vals, '' if $count == 0; # allow zero-element vector
$valPos += 4; $valPos += 4;
} else { } else {
# can't yet handle this property flag # can't yet handle this property flag
$et->WarnOnce('Unknown FPX property');
last; last;
} }
} }
unless ($format =~ /^VT_/) { unless ($format =~ /^VT_/) {
my $size = Image::ExifTool::FormatSize($format) * $count; my $size = Image::ExifTool::FormatSize($format) * $count;
last if $valPos + $size > $dirEnd; if ($valPos + $size > $dirEnd) {
$et->WarnOnce("Incorrect FPX $format size");
last;
}
@vals = ReadValue($dataPt, $valPos, $format, $count, $size); @vals = ReadValue($dataPt, $valPos, $format, $count, $size);
# update position to end of value plus padding # update position to end of value plus padding
$valPos += ($count * $size + 3) & 0xfffffffc; $valPos += ($count * $size + 3) & 0xfffffffc;
last; last;
} }
my $size = $oleFormatSize{$format}; my $size = $oleFormatSize{$format};
my ($item, $val); my ($item, $val, $len);
for ($item=0; $item<$count; ++$item) { for ($item=0; $item<$count; ++$item) {
last if $valPos + $size > $dirEnd; if ($valPos + $size > $dirEnd) {
$et->WarnOnce("Truncated FPX $format value");
last;
}
# sometimes VT_VECTOR items are padded to even 4-byte boundaries, an
d sometimes they aren't
if ($noPad and defined $len and $len & 0x03) {
my $pad = 4 - ($len & 0x03);
if ($valPos + $pad + $size <= $dirEnd) {
# skip padding if all zeros
$valPos += $pad if substr($$dataPt, $valPos, $pad) eq "\0" x
$pad;
}
}
undef $len;
if ($format eq 'VT_VARIANT') { if ($format eq 'VT_VARIANT') {
my $subType = Get32u($dataPt, $valPos); my $subType = Get32u($dataPt, $valPos);
$valPos += $size; $valPos += $size;
$val = ReadFPXValue($et, $dataPt, $valPos, $subType, $dirEnd, $n oPad, $codePage); $val = ReadFPXValue($et, $dataPt, $valPos, $subType, $dirEnd, $n oPad, $codePage);
last unless defined $val; last unless defined $val;
push @vals, $val; push @vals, $val;
next; # avoid adding $size to $valPos again next; # avoid adding $size to $valPos again
} elsif ($format eq 'VT_FILETIME') { } elsif ($format eq 'VT_FILETIME') {
# convert from time in 100 ns increments to time in seconds # convert from time in 100 ns increments to time in seconds
$val = 1e-7 * Image::ExifTool::Get64u($dataPt, $valPos); $val = 1e-7 * Image::ExifTool::Get64u($dataPt, $valPos);
skipping to change at line 1432 skipping to change at line 1451
} }
} }
$val = Image::ExifTool::ConvertUnixTime($val); $val = Image::ExifTool::ConvertUnixTime($val);
} }
} elsif ($format eq 'VT_DATE') { } elsif ($format eq 'VT_DATE') {
$val = Image::ExifTool::GetDouble($dataPt, $valPos); $val = Image::ExifTool::GetDouble($dataPt, $valPos);
# shift zero from Dec 30, 1899 to Jan 1, 1970 and convert to sec s # shift zero from Dec 30, 1899 to Jan 1, 1970 and convert to sec s
$val = ($val - 25569) * 24 * 3600 if $val != 0; $val = ($val - 25569) * 24 * 3600 if $val != 0;
$val = Image::ExifTool::ConvertUnixTime($val); $val = Image::ExifTool::ConvertUnixTime($val);
} elsif ($format =~ /STR$/) { } elsif ($format =~ /STR$/) {
my $len = Get32u($dataPt, $valPos); $len = Get32u($dataPt, $valPos);
$len *= 2 if $format eq 'VT_LPWSTR'; # convert to byte count $len *= 2 if $format eq 'VT_LPWSTR'; # convert to byte count
last if $valPos + $len + 4 > $dirEnd; if ($valPos + $len + 4 > $dirEnd) {
$et->WarnOnce("Truncated $format value");
last;
}
$val = substr($$dataPt, $valPos + 4, $len); $val = substr($$dataPt, $valPos + 4, $len);
if ($format eq 'VT_LPWSTR') { if ($format eq 'VT_LPWSTR') {
# convert wide string from Unicode # convert wide string from Unicode
$val = $et->Decode($val, 'UCS2'); $val = $et->Decode($val, 'UCS2');
} elsif ($codePage) { } elsif ($codePage) {
my $charset = $Image::ExifTool::charsetName{"cp$codePage"}; my $charset = $Image::ExifTool::charsetName{"cp$codePage"};
if ($charset) { if ($charset) {
$val = $et->Decode($val, $charset); $val = $et->Decode($val, $charset);
} elsif ($codePage == 1200) { # UTF-16, little endian } elsif ($codePage == 1200) { # UTF-16, little endian
$val = $et->Decode($val, 'UCS2', 'II'); $val = $et->Decode($val, 'UCS2', 'II');
} }
} }
$val =~ s/\0.*//s; # truncate at null terminator $val =~ s/\0.*//s; # truncate at null terminator
# update position for string length # update position for string length
# (the spec states that strings should be padded to align # (the spec states that strings should be padded to align
# on even 32-bit boundaries, but this isn't always the case) # on even 32-bit boundaries, but this isn't always the case)
$valPos += $noPad ? $len : ($len + 3) & 0xfffffffc; $valPos += $noPad ? $len : ($len + 3) & 0xfffffffc;
} elsif ($format eq 'VT_BLOB' or $format eq 'VT_CF') { } elsif ($format eq 'VT_BLOB' or $format eq 'VT_CF') {
my $len = Get32u($dataPt, $valPos); my $len = Get32u($dataPt, $valPos); # (use local $len because we
last if $valPos + $len + 4 > $dirEnd; always expect padding)
if ($valPos + $len + 4 > $dirEnd) {
$et->WarnOnce("Truncated $format value");
last;
}
$val = substr($$dataPt, $valPos + 4, $len); $val = substr($$dataPt, $valPos + 4, $len);
# update position for data length plus padding # update position for data length plus padding
# (does this padding disappear in arrays too?) # (does this padding disappear in arrays too?)
$valPos += ($len + 3) & 0xfffffffc; $valPos += ($len + 3) & 0xfffffffc;
} elsif ($format eq 'VT_CLSID') { } elsif ($format eq 'VT_CLSID') {
$val = Image::ExifTool::ASF::GetGUID(substr($$dataPt, $valPos, $ size)); $val = Image::ExifTool::ASF::GetGUID(substr($$dataPt, $valPos, $ size));
} }
$valPos += $size; # update value pointer to end of value $valPos += $size; # update value pointer to end of value
push @vals, $val; push @vals, $val;
} }
 End of changes. 10 change blocks. 
10 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)