summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/libs/regex/src/fileiter.cpp')
-rw-r--r--3rdParty/Boost/src/libs/regex/src/fileiter.cpp21
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
{