mirror of
https://github.com/boostorg/regex.git
synced 2025-07-04 08:06:31 +02:00
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user