Use long for file offset computations

Fixes #2808
Merge branch 'production'