Subject: | Patch to allow modification of package-scoped maximum offset in scan |
On large non-JPEG files, Image::IPTCInfo will not scan the file beyond 8192 bytes for IIM
data. This limit is hard-coded into one of the low-level functions and is not available to
the user for custom configuration. This patch against version 1.9 makes available a
package-scope global variable $Image::IPTCInfo::MAX_FILE_OFFSET which the user can
set as follows:
use Image::IPTCInfo;
$Image::IPTCInfo::MAX_FILE_OFFSET = 8192 * 5;
my $thing = Image::IPTCInfo->new("largefile.tif");
Subject: | Image-IPTCInfo-1.9-Modifiable-Max-Offset.patch |
--- Image-IPTCInfo-1.9/IPTCInfo.pm 2004-09-08 16:42:29.000000000 -0400
+++ Image-IPTCInfo-1.9/IPTCInfo.pm 2006-05-09 16:14:59.000000000 -0400
@@ -17,8 +17,11 @@
'%datanames', # reverse mapping (for saving)
'%listdatasets', # master list of repeating dataset id's
'%listdatanames', # reverse
+ '$MAX_FILE_OFFSET', # maximum offset for blind scan
);
+$MAX_FILE_OFFSET = 8192; # default offset
+
# Debug off for production use
my $debugMode = 0;
my $error;
@@ -767,16 +770,13 @@
#
sub BlindScan
{
- my $MAX = shift;
-
- $MAX = 8192 unless defined($MAX); # keep within first 8192 bytes
- # NOTE: this may need to change
+ my $maxoff = shift() || $MAX_FILE_OFFSET; # modifiable global var
- Log("BlindScan: starting scan, max length $MAX");
+ Log("BlindScan: starting scan, max length $maxoff");
# start digging
my $offset = 0;
- while ($offset <= $MAX)
+ while ($offset <= $maxoff)
{
my $temp;