Bug with Virtual Stacks for large (>2^31) offsets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug with Virtual Stacks for large (>2^31) offsets

Josh Doe-2
I've been trying to read in a 15GB RAW file as a Virtual Stack, and
everything was working fine until I tried to have an offset greater
than 2^31-1, or 2147483647. The resulting Virtual Stack would start at
the beginning of the file instead of 2GB in. I looked in the source
code and found the problem in plugin/FileInfoVirtualStack.java. That
file fails to use longOffset when needed, instead always using offset,
which is an integer (and thus the 2^31-1 problem). There are various
ways to fix it, but here's the one that worked for me (in open()):
if(fi.longOffset>0)
  info[i].longOffset = fi.longOffset + i*(size + fi.gapBetweenImages);
else
  info[i].longOffset = (long)fi.offset + i*(size + fi.gapBetweenImages);

Honestly I'm not sure why there are two different offsets and not just
one offset that's long, but it doesn't matter.

Thanks!
-Josh