diff options
author | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2014-08-06 02:47:02 +0400 |
---|---|---|
committer | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2014-08-06 02:47:02 +0400 |
commit | deb12a4c9d9a31d9064e5d5f148f6108c09c77c5 (patch) | |
tree | 1b2ed550cf8770fd31095094da2fb956196a82a8 /moses/PrefixTree.h | |
parent | 95b04d2558a3019799fd0abf76299be4a5b7fd61 (diff) |
Checking return value of fread to make the compiler shut up.
Diffstat (limited to 'moses/PrefixTree.h')
-rw-r--r-- | moses/PrefixTree.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/moses/PrefixTree.h b/moses/PrefixTree.h index f7a869e49..6dc7858a2 100644 --- a/moses/PrefixTree.h +++ b/moses/PrefixTree.h @@ -172,7 +172,9 @@ public: ptr.clear(); ptr.resize(keys.size()); std::vector<OFF_T> rawOffs(keys.size()); - fread(&rawOffs[0], sizeof(OFF_T), keys.size(), f); + size_t bytes_read = fread(&rawOffs[0], sizeof(OFF_T), keys.size(), f); + UTIL_THROW_IF2(bytes_read != sizeof(OFF_T) * keys.size(), + "Read error at " << HERE); for(size_t i=0; i<ptr.size(); ++i) if (rawOffs[i]) ptr[i].set(f, rawOffs[i]); } |