|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74131 - in sandbox/mmap/boost/mmap: . mapping/posix mapping/win32
From: dsaritz_at_[hidden]
Date: 2011-08-29 10:49:09
Author: psiha
Date: 2011-08-29 10:49:09 EDT (Mon, 29 Aug 2011)
New Revision: 74131
URL: http://svn.boost.org/trac/boost/changeset/74131
Log:
Changed to char (instead of unsigned char) as the "basic" default element/mapping type (as this in line with aliasing rules).
Text files modified:
sandbox/mmap/boost/mmap/mapped_view.hpp | 35 ++++++++++++++++++-----------------
sandbox/mmap/boost/mmap/mapping/posix/mapping.inl | 10 +++++-----
sandbox/mmap/boost/mmap/mapping/win32/mapping.inl | 10 +++++-----
3 files changed, 28 insertions(+), 27 deletions(-)
Modified: sandbox/mmap/boost/mmap/mapped_view.hpp
==============================================================================
--- sandbox/mmap/boost/mmap/mapped_view.hpp (original)
+++ sandbox/mmap/boost/mmap/mapped_view.hpp 2011-08-29 10:49:09 EDT (Mon, 29 Aug 2011)
@@ -33,14 +33,14 @@
{
//------------------------------------------------------------------------------
-typedef iterator_range<unsigned char *> basic_memory_range_t;
-typedef iterator_range<unsigned char const *> basic_read_only_memory_range_t;
+typedef iterator_range<char *> basic_memory_range_t;
+typedef iterator_range<char const *> basic_read_only_memory_range_t;
template <typename Element, typename Impl = BOOST_MMAP_IMPL()>
class mapped_view_reference;
-typedef mapped_view_reference<unsigned char > basic_mapped_view_ref;
-typedef mapped_view_reference<unsigned char const> basic_mapped_read_only_view_ref;
+typedef mapped_view_reference<char > basic_mapped_view_ref;
+typedef mapped_view_reference<char const> basic_mapped_read_only_view_ref;
namespace detail
{
@@ -55,16 +55,16 @@
std ::size_t desired_size
)
{
- return make_typed_view( mapper<unsigned char, Impl>::map( source_mapping, offset, desired_size ) );
+ return make_typed_view( mapper<char, Impl>::map( source_mapping, offset, desired_size ) );
}
static void unmap( mapped_view_reference<Element, Impl> const & view )
{
- mapper<unsigned char, Impl>::unmap( make_basic_view( view ) );
+ mapper<char, Impl>::unmap( make_basic_view( view ) );
}
private:
- static mapped_view_reference<unsigned char, Impl>
+ static mapped_view_reference<char, Impl>
#ifdef BOOST_MSVC
const &
#endif
@@ -74,20 +74,20 @@
#ifdef BOOST_MSVC
const &
#endif
- make_typed_view( mapped_view_reference<unsigned char, Impl> const & );
+ make_typed_view( mapped_view_reference<char, Impl> const & );
};
template <typename Impl>
- struct mapper<unsigned char, Impl>
+ struct mapper<char, Impl>
{
- static mapped_view_reference<unsigned char, Impl> map
+ static mapped_view_reference<char, Impl> map
(
mapping<Impl> const & source_mapping,
boost::uint64_t offset ,
std ::size_t desired_size
);
- static void unmap( mapped_view_reference<unsigned char, Impl> const & );
+ static void unmap( mapped_view_reference<char, Impl> const & );
};
} // namespace detail
@@ -141,7 +141,7 @@
// (14.07.2011.) (Domagoj Saric)
template <typename Element, typename Impl>
- mapped_view_reference<unsigned char, Impl>
+ mapped_view_reference<char, Impl>
#ifdef BOOST_MSVC
const &
#endif
@@ -149,12 +149,12 @@
{
return
#ifdef BOOST_MSVC
- reinterpret_cast<mapped_view_reference<unsigned char, Impl> const &>( range );
+ reinterpret_cast<mapped_view_reference<char, Impl> const &>( range );
#else // compiler might care about strict aliasing rules
- mapped_view_reference<unsigned char, Impl>
+ mapped_view_reference<char, Impl>
(
- static_cast<unsigned char *>( const_cast<void *>( static_cast<void const *>( range.begin() ) ) ),
- static_cast<unsigned char *>( const_cast<void *>( static_cast<void const *>( range.end () ) ) )
+ static_cast<char *>( const_cast<void *>( static_cast<void const *>( range.begin() ) ) ),
+ static_cast<char *>( const_cast<void *>( static_cast<void const *>( range.end () ) ) )
);
#endif // compiler
}
@@ -165,7 +165,7 @@
#ifdef BOOST_MSVC
const &
#endif
- mapper<Element, Impl>::make_typed_view( mapped_view_reference<unsigned char, Impl> const & range )
+ mapper<Element, Impl>::make_typed_view( mapped_view_reference<char, Impl> const & range )
{
//...zzz...add proper error handling...
BOOST_ASSERT( reinterpret_cast<std::size_t>( range.begin() ) % sizeof( Element ) == 0 );
@@ -216,6 +216,7 @@
#endif // BOOST_MSVC
};
+typedef mapped_view<char> basic_mapped_view;
basic_mapped_view_ref map_file ( char const * file_name, std::size_t desired_size );
basic_mapped_read_only_view_ref map_read_only_file( char const * file_name );
Modified: sandbox/mmap/boost/mmap/mapping/posix/mapping.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mapping/posix/mapping.inl (original)
+++ sandbox/mmap/boost/mmap/mapping/posix/mapping.inl 2011-08-29 10:49:09 EDT (Mon, 29 Aug 2011)
@@ -25,16 +25,16 @@
//------------------------------------------------------------------------------
template <>
-struct detail::mapper<unsigned char, posix>
+struct detail::mapper<char, posix>
{
- static mapped_view_reference<unsigned char, posix> map
+ static mapped_view_reference<char, posix> map
(
mapping<posix> const & source_mapping,
boost::uint64_t offset ,
std ::size_t desired_size
)
{
- typedef mapped_view_reference<unsigned char, posix>::iterator iterator;
+ typedef mapped_view_reference<char, posix>::iterator iterator;
iterator const view_start
(
@@ -52,7 +52,7 @@
)
);
- return mapped_view_reference<unsigned char>
+ return mapped_view_reference<char>
(
view_start,
( view_start != MAP_FAILED )
@@ -61,7 +61,7 @@
);
}
- static void unmap( mapped_view_reference<unsigned char, posix> const & view )
+ static void unmap( mapped_view_reference<char, posix> const & view )
{
BOOST_VERIFY
(
Modified: sandbox/mmap/boost/mmap/mapping/win32/mapping.inl
==============================================================================
--- sandbox/mmap/boost/mmap/mapping/win32/mapping.inl (original)
+++ sandbox/mmap/boost/mmap/mapping/win32/mapping.inl 2011-08-29 10:49:09 EDT (Mon, 29 Aug 2011)
@@ -25,9 +25,9 @@
//------------------------------------------------------------------------------
template <>
-struct detail::mapper<unsigned char, win32>
+struct detail::mapper<char, win32>
{
- static mapped_view_reference<unsigned char, win32> map
+ static mapped_view_reference<char, win32> map
(
mapping<win32> const & source_mapping,
boost::uint64_t offset ,
@@ -40,7 +40,7 @@
// http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx
// (26.03.2010.) (Domagoj Saric)
- typedef mapped_view_reference<unsigned char, win32>::iterator iterator;
+ typedef mapped_view_reference<char, win32>::iterator iterator;
ULARGE_INTEGER large_integer;
large_integer.QuadPart = offset;
@@ -60,7 +60,7 @@
)
);
- return mapped_view_reference<unsigned char>
+ return mapped_view_reference<char>
(
view_start,
view_start
@@ -69,7 +69,7 @@
);
}
- static void unmap( mapped_view_reference<unsigned char, win32> const & view )
+ static void unmap( mapped_view_reference<char, win32> const & view )
{
BOOST_VERIFY( ::UnmapViewOfFile( view.begin() ) || view.empty() );
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk