diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/libs/regex/src/fileiter.cpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/libs/regex/src/fileiter.cpp')
-rw-r--r-- | 3rdParty/Boost/src/libs/regex/src/fileiter.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp index 7d9c7f8..ff1d111 100644 --- a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp +++ b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp @@ -258,11 +258,22 @@ void mapfile::lock(pointer* node)const *p = 0; *(reinterpret_cast<int*>(*node)) = 1; } - std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); - if(node == _last - 1) - std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); - else - std::fread(*node + sizeof(int), buf_size, 1, hfile); + + std::size_t read_size = 0; + int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); + + if(0 == read_pos && node == _last - 1) + read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); + else + read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile); +#ifndef BOOST_NO_EXCEPTIONS + if((read_size == 0) || (std::ferror(hfile))) + { + throw std::runtime_error("Unable to read file."); + } +#else + BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); +#endif } else { |