##
BUCKET:
for (my $i = 0; $i < $self->{max_buckets}; $i++) {
- my $subloc = $self->_get_subloc( $keys, $i );
+ my ($key, $subloc) = $self->_get_key_subloc( $keys, $i );
if (!$subloc) {
##
last;
}
- my $key = substr($keys, $i * $self->{bucket_size}, $self->{hash_size});
if ( $md5 ne $key ) {
next BUCKET;
}
BUCKET:
for (my $i = 0; $i <= $self->{max_buckets}; $i++) {
- my $key = substr(
- $keys,
- ($i * $self->{bucket_size}),
- $self->{hash_size},
- );
+ my ($key, $old_subloc) = $self->_get_key_subloc( $keys, $i );
next BUCKET unless $key;
- my $old_subloc = $self->_get_subloc( $keys, $i );
-
my $num = ord(substr($key, $tag->{ch} + 1, 1));
if ($offsets[$num]) {
read( $fh, $subkeys, $self->{bucket_list_size});
for (my $k=0; $k<$self->{max_buckets}; $k++) {
- my $subloc = $self->_get_subloc( $subkeys, $k );
+ my ($temp, $subloc) = $self->_get_key_subloc( $subkeys, $k );
if (!$subloc) {
seek($fh, $offset + ($k * $self->{bucket_size}) + $root->{file_offset}, SEEK_SET);
##
BUCKET:
for (my $i = 0; $i < $self->{max_buckets}; $i++) {
- my $subloc = $self->_get_subloc( $keys, $i );
+ my ($key, $subloc) = $self->_get_key_subloc( $keys, $i );
if (!$subloc) {
##
return;
}
- my $key = substr($keys, $i * $self->{bucket_size}, $self->{hash_size});
if ( $md5 ne $key ) {
next BUCKET;
}
##
BUCKET:
for (my $i=0; $i<$self->{max_buckets}; $i++) {
- my $key = substr($keys, $i * $self->{bucket_size}, $self->{hash_size});
-# my $subloc = unpack($self->{long_pack}, substr($keys, ($i * $self->{bucket_size}) + $self->{hash_size}, $self->{long_size}));
- my $subloc = $self->_get_subloc( $keys, $i );
+ my ($key, $subloc) = $self->_get_key_subloc( $keys, $i );
if (!$subloc) {
##
##
BUCKET:
for (my $i=0; $i<$self->{max_buckets}; $i++) {
- my $key = substr($keys, $i * $self->{bucket_size}, $self->{hash_size});
- #my $subloc = unpack($self->{long_pack}, substr($keys, ($i * $self->{bucket_size}) + $self->{hash_size}, $self->{long_size}));
- my $subloc = $self->_get_subloc( $keys, $i );
+ my ($key, $subloc) = $self->_get_key_subloc( $keys, $i );
if (!$subloc) {
##
# Iterate through buckets, looking for a key match
##
for (my $i=0; $i<$self->{max_buckets}; $i++) {
- my $key = substr($keys, $i * $self->{bucket_size}, $self->{hash_size});
-# my $subloc = unpack(
-# $self->{long_pack},
-# substr(
-# $keys,
-# ($i * $self->{bucket_size}) + $self->{hash_size},
-# $self->{long_size},
-# ),
-# );
- my $subloc = $self->_get_subloc( $keys, $i );
+ my ($key, $subloc) = $self->_get_key_subloc( $keys, $i );
if (!$subloc) {
##
# Utilities
-sub _get_subloc {
+sub _get_key_subloc {
my $self = shift;
my ($keys, $idx) = @_;
- my $subloc = unpack(
- $self->{long_pack},
+ my ($key, $subloc) = unpack(
+ "a$self->{hash_size} $self->{long_pack}",
substr(
$keys,
- ($idx * $self->{bucket_size}) + $self->{hash_size},
- $self->{long_size},
+ ($idx * $self->{bucket_size}),
+ $self->{bucket_size},
),
);
- return $subloc;
+ return ($key, $subloc);
}
1;