Fix type conversion error breaking large files

Cast it to a long sure. Changing it to a long doesn't make sense, e.g. we use it as a decode buffer size in some places.