check return value from std::fread
This commit is contained in:
parent
bfc7ad397a
commit
a220bda05d
1 changed files with 2 additions and 5 deletions
|
@ -83,11 +83,8 @@ public:
|
||||||
if (!size_) return nullptr;
|
if (!size_) return nullptr;
|
||||||
std::fseek(file_.get(), 0, SEEK_SET);
|
std::fseek(file_.get(), 0, SEEK_SET);
|
||||||
data_type buffer(new char[size_]);
|
data_type buffer(new char[size_]);
|
||||||
#pragma GCC diagnostic push
|
auto count = std::fread(buffer.get(), size_, 1, file_.get());
|
||||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
if (count != 1) return nullptr;
|
||||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
|
||||||
std::fread(buffer.get(), size_, 1, file_.get());
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue