fixing int32 and int64 warnings

Trying again to submit a pull request to fix warnings about casts. This time I'm using ssize_t and -1 is still used.