Adds more 64-bit fixes

Replaces more `int` with `long` where it makes sense.

Also , it repalces some `unsigned long` with `long` for "lenght"
values as described in our c++ guideline