Boost logo

Boost :

From: Dave Odell (dmo2118_at_[hidden])
Date: 2006-06-13 16:34:17


When I run the following program (under Windows XP, Visual C++ 8), the
BOOST_ASSERT statement fails (If you want to run it, make sure there's a
file named temp.cpp in the same folder):

#include <boost/iostreams/device/mapped_file.hpp>
#include <iostream>

int main()
{
    try
    {
        boost::iostreams::mapped_file file;
        file.open("temp.cpp", std::ios_base::in);
        file.close();
        BOOST_ASSERT(!file.is_open());
    }
    catch(const std::exception &exc)
    {
        std::cout << exc.what() << std::endl;
    }

    return 0;
}

I think the problem is in mapped_file.cpp, line 124:

bool mapped_file_source::is_open() const
{ return !!pimpl_ && pimpl_->handle_ != 0; }

Since mapped_file_impl::close() sets handle_ to INVALID_HANDLE_VALUE
(mapped_file.cpp, line 65), I would guess that is_open() should say
pimpl_->handle_ != INVALID_HANDLE_VALUE.

Dave Odell
dmo2118_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk