Ticket #3505: mapped_file.cpp.patch

File mapped_file.cpp.patch, 1.4 KB (added by yrs90@…, 13 years ago)

mapped_file, Windows build, invalid handle check patch

  • new file .hgignore

    diff -r 23a892ae0220 .hgignore
    - +  
     1# This file supports two syntax types, glob and regexp.
     2# In either case, the backslash is an escape and must be doubled to get a literal backslash
     3
     4syntax: glob
     5
     6# Exclude object files:
     7bin.v2
     8BoostBuildLog.txt
     9 No newline at end of file
  • libs/iostreams/src/mapped_file.cpp

    diff -r 23a892ae0220 libs/iostreams/src/mapped_file.cpp
    a b  
    169169    #ifndef NDEBUG
    170170        msg += std::string(" (\"") + impl.path_ + "\")";
    171171    #endif
    172     if (impl.mapped_handle_ != INVALID_HANDLE_VALUE)
     172    if (impl.mapped_handle_ != NULL)
    173173        ::CloseHandle(impl.mapped_handle_);
    174     if (impl.handle_ != NULL)
     174    if (impl.handle_ != INVALID_HANDLE_VALUE)
    175175        ::CloseHandle(impl.handle_);
    176176    impl.clear(true);
    177177    throw_system_failure(msg);
     
    399399    return;
    400400}
    401401
     402#ifdef BOOST_IOSTREAMS_WINDOWS
     403bool mapped_file_source::is_open() const
     404{ return !!pimpl_ && pimpl_->handle_ != INVALID_HANDLE_VALUE; }
     405#else
    402406bool mapped_file_source::is_open() const
    403407{ return !!pimpl_ && pimpl_->handle_ != 0; }
     408#endif
    404409
    405410int mapped_file_source::alignment()
    406411{ return static_cast<int>(sysconf(_SC_PAGESIZE)); }