There are implicit casts between size_t and int here that can be solved multiple ways. This attempts to keep values as close to their declared types.