|
|
@ -233,13 +233,14 @@ class WinMmapReadableFile : public RandomAccessFile { |
|
|
|
char* scratch) const override { |
|
|
|
char* scratch) const override { |
|
|
|
Status s; |
|
|
|
Status s; |
|
|
|
|
|
|
|
|
|
|
|
if (offset + n > length_) { |
|
|
|
if (offset > length_) { |
|
|
|
*result = Slice(); |
|
|
|
*result = Slice(); |
|
|
|
s = IOError(fileName_, EINVAL); |
|
|
|
return IOError(fileName_, EINVAL); |
|
|
|
} else { |
|
|
|
} else if (offset + n > length_) { |
|
|
|
|
|
|
|
n = length_ - offset; |
|
|
|
|
|
|
|
} |
|
|
|
*result = |
|
|
|
*result = |
|
|
|
Slice(reinterpret_cast<const char*>(mapped_region_) + offset, n); |
|
|
|
Slice(reinterpret_cast<const char*>(mapped_region_) + offset, n); |
|
|
|
} |
|
|
|
|
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|