fix valid byte range check and send asset from 0

This commit is contained in:
Stephen Birarda 2017-04-18 13:51:08 -07:00 committed by Atlante45
parent d9c5997b63
commit 3928e11611
2 changed files with 4 additions and 4 deletions

View file

@ -88,7 +88,7 @@ void SendAssetTask::run() {
auto size = byteRange.size();
if (byteRange.fromInclusive > 0) {
if (byteRange.fromInclusive >= 0) {
// this range is positive, meaning we just need to seek into the file and then read from there
file.seek(byteRange.fromInclusive);

View file

@ -24,9 +24,9 @@ struct ByteRange {
// (2) the toExclusive of the range is less than the fromInclusive, and isn't zero
// (3) the fromExclusive of the range is negative, and the toExclusive isn't zero
bool isValid() {
return toExclusive < 0
|| (toExclusive < fromInclusive && toExclusive != 0)
|| (fromInclusive < 0 && toExclusive != 0);
return toExclusive >= 0
&& (toExclusive >= fromInclusive || toExclusive == 0)
&& (fromInclusive >= 0 || toExclusive == 0);
}
void fixupRange(int64_t fileSize) {