Fix -Wextra Warnings

Cast size_t to long in long-size_t comparisons