* Check if the requested range is valid.
*
* start: the first byte position of the range request
* end: the end byte position of the range request
* contentLength: the content length of the requested data
* sum: the sum of bytes of the range request
*/
bool isValid(int start, int end, int contentLength, int* sum )) {
if (start < end) {
*sum += end - start;
if (*sum > contentLength) {
return false;
} else {
return true;
}
} else {
return false;
}
}