Use type long for offset

On 64bit Linux, when the filter file grows more than 2G, the 32bit `offset` will overflow.