Commit 51191c7a authored by Alberto Ramos's avatar Alberto Ramos

Corrected bug in BDIO_seek!

Thanks to Fabian Joswig <fabian.joswig@wwu.de>

When calling BDIO_seek the very last record of a bdio file cannot be
accessed due to ipt < length(fb.records)) and ipt starting at 1. If I
understand it correctly you would have to change the condition to ipt
<= length(fb.records)) in order to be able to access the last
record. I noticed this because I did not attach an additional record
containing the hash and then BDIO_seek immediately returns false.
parent bf3f88e4
...@@ -267,7 +267,7 @@ function BDIO_seek!(fb::BDIOstream, icnt::Int = 1) ...@@ -267,7 +267,7 @@ function BDIO_seek!(fb::BDIOstream, icnt::Int = 1)
else else
ipt += icnt ipt += icnt
end end
if (ipt < length(fb.records))&&(ipt > 0) if (ipt <= length(fb.records))&&(ipt > 0)
fb.ipt = ipt fb.ipt = ipt
fb.rwpos = 0 fb.rwpos = 0
return true return true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment