diff --git a/README.md b/README.md index cd955f5..aa630f3 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ int main() // length of the mapping is otherwise expected, with the factory method. std::error_code error; mio::mmap_sink rw_mmap = mio::make_mmap_sink( - "file.txt", 0, mio::map_entire_file, error); + "file.txt", 0, mio::map_entire_file, error); if (error) { return handle_error(error); } // You can use any iterator based function. @@ -103,7 +103,7 @@ int main() // Now create the same mapping, but in read-only mode. mio::mmap_source ro_mmap = mio::make_mmap_source( - "file.txt", 0, mio::map_entire_file, error); + "file.txt", 0, mio::map_entire_file, error); if (error) { return handle_error(error); } const int the_answer_to_everything = ro_mmap[answer_index]; diff --git a/include/mio/detail/basic_mmap.ipp b/include/mio/detail/basic_mmap.ipp index 1fd4e70..835e9f1 100644 --- a/include/mio/detail/basic_mmap.ipp +++ b/include/mio/detail/basic_mmap.ipp @@ -348,7 +348,6 @@ void basic_mmap::unmap() { ::UnmapViewOfFile(get_mapping_start()); ::CloseHandle(file_mapping_handle_); - file_mapping_handle_ = INVALID_HANDLE_VALUE; } #else if(data_) { ::munmap(const_cast(get_mapping_start()), mapped_length_); } diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index b1539ce..419509e 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -301,14 +301,14 @@ public: /** * This is the basis for all read-only mmap objects and should be preferred over - * directly using basic_mmap. + * directly using `basic_mmap`. */ template using basic_mmap_source = basic_mmap; /** * This is the basis for all read-write mmap objects and should be preferred over - * directly using basic_mmap. + * directly using `basic_mmap`. */ template using basic_mmap_sink = basic_mmap; @@ -323,7 +323,7 @@ using ummap_source = basic_mmap_source; using mmap_sink = basic_mmap_sink; using ummap_sink = basic_mmap_sink; -/** Convenience factory method that constructs a mapping for any basic_mmap<> type. */ +/** Convenience factory method that constructs a mapping for any `basic_mmap` type. */ template< typename MMap, typename MappingToken @@ -340,7 +340,7 @@ template< * * MappingToken may be a String (`std::string`, `std::string_view`, `const char*`, * `std::filesystem::path`, `std::vector`, or similar), or a - * mmap_source::file_handle. + * `mmap_source::handle_type`. */ template mmap_source make_mmap_source(const MappingToken& token, mmap_source::size_type offset, @@ -354,7 +354,7 @@ mmap_source make_mmap_source(const MappingToken& token, mmap_source::size_type o * * MappingToken may be a String (`std::string`, `std::string_view`, `const char*`, * `std::filesystem::path`, `std::vector`, or similar), or a - * mmap_sink::file_handle. + * `mmap_sink::handle_type`. */ template mmap_sink make_mmap_sink(const MappingToken& token, mmap_sink::size_type offset, diff --git a/test/example.cpp b/test/example.cpp index 5385ffc..2fecb02 100644 --- a/test/example.cpp +++ b/test/example.cpp @@ -17,7 +17,7 @@ int main() // length of the mapping is otherwise expected, with the factory method. std::error_code error; mio::mmap_sink rw_mmap = mio::make_mmap_sink( - "file.txt", 0, mio::map_entire_file, error); + "file.txt", 0, mio::map_entire_file, error); if (error) { return handle_error(error); } // You can use any iterator based function. @@ -45,7 +45,7 @@ int main() // Now create the same mapping, but in read-only mode. mio::mmap_source ro_mmap = mio::make_mmap_source( - "file.txt", 0, mio::map_entire_file, error); + "file.txt", 0, mio::map_entire_file, error); if (error) { return handle_error(error); } const int the_answer_to_everything = ro_mmap[answer_index]; diff --git a/test/test.cpp b/test/test.cpp index 01536a6..acfd33c 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -33,19 +33,17 @@ int main() { // Map the region of the file to which buffer was written. mio::mmap_source file_view = mio::make_mmap_source( - path, 0, mio::map_entire_file, error); + path, 0, mio::map_entire_file, error); if(error) { return handle_error(error); } assert(file_view.is_open()); assert(file_view.size() == buffer.size()); // Then verify that mmap's bytes correspond to that of buffer. - for(auto i = 0; i < buffer.size(); ++i) - { - if(file_view[i] != buffer[i]) - { + for(auto i = 0; i < buffer.size(); ++i) { + if(file_view[i] != buffer[i]) { std::printf("%ith byte mismatch: expected(%i) <> actual(%i)", - i, buffer[i], file_view[i]); + i, buffer[i], file_view[i]); assert(0); } } @@ -58,12 +56,10 @@ int main() assert(shared_file_view.size() == buffer.size()); // Then verify that mmap's bytes correspond to that of buffer. - for(auto i = 0; i < buffer.size(); ++i) - { - if(shared_file_view[i] != buffer[i]) - { + for(auto i = 0; i < buffer.size(); ++i) { + if(shared_file_view[i] != buffer[i]) { std::printf("%ith byte mismatch: expected(%i) <> actual(%i)", - i, buffer[i], shared_file_view[i]); + i, buffer[i], shared_file_view[i]); assert(0); } }