1 --- foo/misc/boost/boost/spirit/home/classic/iterator/impl/file_iterator.ipp.orig
2 +++ foo/misc/boost/boost/spirit/home/classic/iterator/impl/file_iterator.ipp
3 @@ -181,67 +181,28 @@ public:
6 explicit mmap_file_iterator(std::string const& fileName)
7 - : m_filesize(0), m_curChar(0)
9 - HANDLE hFile = ::CreateFileA(
10 + : mmap_file_iterator(::CreateFileA(
14 + FILE_SHARE_READ | FILE_SHARE_WRITE,
17 FILE_FLAG_SEQUENTIAL_SCAN,
21 - if (hFile == INVALID_HANDLE_VALUE)
24 - // Store the size of the file, it's used to construct
26 - m_filesize = ::GetFileSize(hFile, NULL);
30 - HANDLE hMap = ::CreateFileMapping(
32 + explicit mmap_file_iterator(std::wstring const& fileName)
33 + : mmap_file_iterator(::CreateFileW(
36 + FILE_SHARE_READ | FILE_SHARE_WRITE,
41 + FILE_FLAG_SEQUENTIAL_SCAN,
47 - ::CloseHandle(hFile);
51 - LPVOID pMem = ::MapViewOfFile(
59 - ::CloseHandle(hMap);
60 - ::CloseHandle(hFile);
64 - // We hold both the file handle and the memory pointer.
65 - // We can close the hMap handle now because Windows holds internally
66 - // a reference to it since there is a view mapped.
67 - ::CloseHandle(hMap);
69 - // It seems like we can close the file handle as well (because
70 - // a reference is hold by the filemap object).
71 - ::CloseHandle(hFile);
73 - // Store the handles inside the shared_ptr (with the custom destructors)
74 - m_mem.reset(static_cast<CharT*>(pMem), ::UnmapViewOfFile);
76 - // Start of the file
77 - m_curChar = m_mem.get();
82 mmap_file_iterator(const mmap_file_iterator& iter)
84 @@ -290,6 +251,59 @@ private:
85 boost::shared_ptr<CharT> m_mem;
86 std::size_t m_filesize;
89 + explicit mmap_file_iterator(HANDLE hFile)
90 + : m_filesize(0), m_curChar(0)
92 + if (hFile == INVALID_HANDLE_VALUE)
95 + // Store the size of the file, it's used to construct
97 + m_filesize = ::GetFileSize(hFile, NULL);
99 + HANDLE hMap = ::CreateFileMapping(
109 + ::CloseHandle(hFile);
113 + LPVOID pMem = ::MapViewOfFile(
121 + ::CloseHandle(hMap);
122 + ::CloseHandle(hFile);
126 + // We hold both the file handle and the memory pointer.
127 + // We can close the hMap handle now because Windows holds internally
128 + // a reference to it since there is a view mapped.
129 + ::CloseHandle(hMap);
131 + // It seems like we can close the file handle as well (because
132 + // a reference is hold by the filemap object).
133 + ::CloseHandle(hFile);
135 + // Store the handles inside the shared_ptr (with the custom destructors)
136 + m_mem.reset(static_cast<CharT*>(pMem), ::UnmapViewOfFile);
138 + // Start of the file
139 + m_curChar = m_mem.get();
143 #endif // BOOST_SPIRIT_FILEITERATOR_WINDOWS
144 --- foo/misc/boost/boost/spirit/home/classic/iterator/file_iterator.hpp.orig
145 +++ foo/misc/boost/boost/spirit/home/classic/iterator/file_iterator.hpp
146 @@ -170,6 +170,12 @@ public:
147 : base_t(adapted_t(fileName))
150 +#ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS
151 + file_iterator(std::wstring const& fileName)
152 + : base_t(adapted_t(fileName))
156 file_iterator(const base_t& iter)