Skip to content

Fix typo in fastForward  #72

@pmqs

Description

@pmqs

In fastForward, shown below, the code is intended to read 16k buffers, but it doesn't.

The code length $offset is returning the number of bytes in the string re[presentation of the number stored in $offset. So if $offset contains the number 1234, it will get converted to the string "1234" when length is called. That string contains 4 bytes.

sub fastForward {
    my $self   = shift;
    my $offset = shift;     

    my $buffer = '';
    my $c = 1024 * 16;        

    while ($offset > 0) {
        $c = length $offset   
            if length $offset < $c ;  
        $offset -= $c;
        $self->smartReadExact(\$buffer, $c)
            or return 0;
    }
    return 1;
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions