Throw IO error if the number of read bytes does not match count
and the stream is in failed state
This commit is contained in:
parent
46ac9d05d9
commit
7deff5837c
@ -73,8 +73,9 @@ class FileReader
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const auto &result = input_stream.read(reinterpret_cast<char *>(dest), count * sizeof(T));
|
const auto &result = input_stream.read(reinterpret_cast<char *>(dest), count * sizeof(T));
|
||||||
|
const std::size_t bytes_read = input_stream.gcount();
|
||||||
|
|
||||||
if (!result)
|
if (bytes_read != count && !result)
|
||||||
{
|
{
|
||||||
if (result.eof())
|
if (result.eof())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user