Changes for ticket #10718

I used std::numeric_limits<unsigned>::max(); instead of UINT_MAX from <climits> as originally proposed as this is the C++ way of doing this.