|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85290 - in sandbox/gil/boost/gil/extension/io2: backends/detail backends/libtiff backends/wic detail devices
From: dsaritz_at_[hidden]
Date: 2013-08-10 17:30:57
Author: psiha
Date: 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013)
New Revision: 85290
URL: http://svn.boost.org/trac/boost/changeset/85290
Log:
Minor refactoring and stylistic changes.
Minor preliminary documentation preparations.
Text files modified:
sandbox/gil/boost/gil/extension/io2/backends/detail/backend.hpp | 20 +++++++---
sandbox/gil/boost/gil/extension/io2/backends/detail/reader_for.hpp | 24 ++++++++----
sandbox/gil/boost/gil/extension/io2/backends/detail/writer_for.hpp | 13 +++---
sandbox/gil/boost/gil/extension/io2/backends/libtiff/backend.hpp | 45 ++++++++++++++----------
sandbox/gil/boost/gil/extension/io2/backends/libtiff/reader.hpp | 23 ++++++++---
sandbox/gil/boost/gil/extension/io2/backends/wic/backend.hpp | 11 +++--
sandbox/gil/boost/gil/extension/io2/backends/wic/extern_lib_guard.hpp | 42 +++++++++++++++-------
sandbox/gil/boost/gil/extension/io2/backends/wic/writer.hpp | 9 +++-
sandbox/gil/boost/gil/extension/io2/detail/windows_shared_istreams.hpp | 41 +++++++++++++---------
sandbox/gil/boost/gil/extension/io2/devices/c_file_descriptor.hpp | 73 ++++++++++++++++++++-------------------
sandbox/gil/boost/gil/extension/io2/devices/c_file_name.hpp | 11 +++--
sandbox/gil/boost/gil/extension/io2/devices/device.hpp | 8 ++--
12 files changed, 190 insertions(+), 130 deletions(-)
Modified: sandbox/gil/boost/gil/extension/io2/backends/detail/backend.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/detail/backend.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/detail/backend.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,9 +5,10 @@
///
/// Base CRTP class for all image implementation classes/backends.
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -180,7 +181,7 @@
return result_type();
}
};
-};
+}; // class backend_base
////////////////////////////////////////////////////////////////////////////////
@@ -197,7 +198,7 @@
typedef typename backend_traits<Impl>::supported_pixel_formats_t supported_pixel_formats;
typedef typename backend_traits<Impl>::roi_t roi;
- typedef typename roi::offset_t offset_t;
+ typedef typename roi::offset_t offset_t;
template <typename PixelType, bool IsPlanar>
struct native_format
@@ -218,6 +219,14 @@
template <typename Source> struct reader_for : gil::io::reader_for<Impl, Source> {};
template <typename Target> struct writer_for : gil::io::writer_for<Impl, Target> {};
+#ifdef DOXYGEN_ONLY
+ class native_reader;
+ class device_reader;
+
+ class native_writer;
+ class device_writer;
+#endif // DOXYGEN_ONLY
+
BOOST_STATIC_CONSTANT( bool, has_full_roi = (is_same<typename roi::offset_t, typename roi::point_t>::value) );
protected:
@@ -229,8 +238,7 @@
// MSVC++ 10 generates code to check whether this == 0.
Impl & impl() { BF_ASSUME( this != 0 ); return static_cast<Impl &>( *this ); }
Impl const & impl() const { BF_ASSUME( this != 0 ); return static_cast<Impl const &>( *this ); }
-};
-
+}; // class backend
//------------------------------------------------------------------------------
} // namespace detail
Modified: sandbox/gil/boost/gil/extension/io2/backends/detail/reader_for.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/detail/reader_for.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/detail/reader_for.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -3,9 +3,10 @@
/// \file reader_for.hpp
/// --------------------
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -66,14 +67,19 @@
template <class Backend, typename Source>
struct reader_for
{
- typedef typename mpl::has_key<typename backend_traits<Backend>::native_sources, Source>::type supported_by_native_reader_t;
+ typedef typename
+ mpl::has_key
+ <
+ typename backend_traits<Backend>::native_sources,
+ Source
+ >::type supported_by_native_reader_t;
- // The backend does not seem to provide a reader for the specified target...
- BOOST_STATIC_ASSERT
- ((
+ BOOST_STATIC_ASSERT_MSG
+ (
supported_by_native_reader_t::value ||
- !unknown_device<Source> ::value
- ));
+ !unknown_device<Source> ::value,
+ "Backend does not provide a reader for the specified target."
+ );
typedef typename mpl::if_
<
@@ -81,7 +87,7 @@
typename Backend::native_reader,
detail::reader_extender<typename Backend::device_reader, Source>
>::type type;
-};
+}; // struct reader_for
template <class Backend>
Modified: sandbox/gil/boost/gil/extension/io2/backends/detail/writer_for.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/detail/writer_for.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/detail/writer_for.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -3,9 +3,10 @@
/// \file writer_for.hpp
/// --------------------
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -60,7 +61,7 @@
output_device<Target>( target ),
Writer ( output_device<Target>::transform( target ), file_format )
{}
-};
+}; // class writer_extender
////////////////////////////////////////////////////////////////////////////////
@@ -107,7 +108,7 @@
BOOST_VERIFY( specified_format == OnlyFormat );
}
};
-};
+}; // struct configure_on_write_writer
////////////////////////////////////////////////////////////////////////////////
@@ -151,7 +152,7 @@
void write_default( WriterTarget const & target, format_tag const specified_format = OnlyFormat ) { BOOST_VERIFY( specified_format == OnlyFormat ); Writer::write_default( target ); }
void write ( WriterTarget const & target, format_tag const specified_format = OnlyFormat ) { BOOST_VERIFY( specified_format == OnlyFormat ); Writer::write ( target ); }
};
-};
+}; // struct open_on_write_writer
//------------------------------------------------------------------------------
} // namespace detail
@@ -196,7 +197,7 @@
typename backend_traits<Backend>::writer_view_data_t,
default_format
> type;
-};
+}; // struct writer_for
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/backends/libtiff/backend.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/libtiff/backend.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/libtiff/backend.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,9 +5,10 @@
///
/// LibTIFF backend.
///
-/// Copyright (c) Domagoj Saric 2010.
+/// Copyright (c) 2010.-2013. Domagoj Saric
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -26,8 +27,12 @@
#include "boost/gil/extension/io2/detail/platform_specifics.hpp"
#include "boost/gil/extension/io2/detail/shared.hpp"
-#if BOOST_MPL_LIMIT_VECTOR_SIZE < 35
- #error libtiff support requires mpl vectors of size 35 or greater...
+#ifdef BOOST_MPL_LIMIT_VECTOR_SIZE
+ #if BOOST_MPL_LIMIT_VECTOR_SIZE < 35
+ #error libtiff support requires mpl vectors of size 35 or greater...
+ #endif
+#else
+ #define BOOST_MPL_LIMIT_VECTOR_SIZE 40
#endif
#include <boost/array.hpp>
@@ -92,7 +97,7 @@
format_id number;
format_bitfield bits ;
-};
+}; // union full_format_t
template <typename Pixel, bool isPlanar>
@@ -118,7 +123,7 @@
( is_same<typename color_space_type<Pixel>::type, cmyk_t>::value ? INKSET_CMYK : 0 )
)
>
-{};
+{}; // struct gil_to_libtiff_format
typedef mpl::vector35
@@ -184,7 +189,7 @@
}
template <typename Handle>
-toff_t size( thandle_t const fd )
+toff_t size( thandle_t const handle )
{
return static_cast<toff_t>( device<Handle>::size( reinterpret_cast<Handle>( handle ) ) );
}
@@ -231,7 +236,7 @@
}
-#if defined(BOOST_MSVC)
+#if defined( BOOST_MSVC )
# pragma warning( push )
# pragma warning( disable : 4127 ) // "conditional expression is constant"
#endif
@@ -244,7 +249,7 @@
dimensions_( view.dimensions() ),
stride_ ( view.pixels().row_size() ),
offset_ ( offset )
- #ifdef _DEBUG
+ #ifndef NDEBUG
,format_id_( gil_to_libtiff_format<typename View::value_type, is_planar<View>::value>::value )
#endif
{
@@ -257,13 +262,13 @@
ignore_unused_variable_warning( format );
}
- point2<std::ptrdiff_t> const & dimensions_ ;
+ point2<uint32> const & dimensions_ ;
unsigned int stride_ ;
unsigned int number_of_planes_;
array<unsigned char *, 4> plane_buffers_ ;
generic_vertical_roi::offset_t offset_ ;
- #ifdef _DEBUG
+ #ifndef NDEBUG
unsigned int format_id_;
#endif
@@ -271,11 +276,12 @@
template <class View>
void set_buffers( View const & view, mpl::true_ /*is planar*/ )
{
- for ( number_of_planes_ = 0; number_of_planes_ < num_channels<View>::value; ++number_of_planes_ )
+ for ( unsigned int plane( 0 ); plane < num_channels<View>::value; ++plane )
{
- plane_buffers_[ number_of_planes_ ] = gil_reinterpret_cast<unsigned char *>( planar_view_get_raw_data( view, number_of_planes_ ) );
+ plane_buffers_[ plane ] = gil_reinterpret_cast<unsigned char *>( planar_view_get_raw_data( view, plane ) );
}
- BOOST_ASSERT( number_of_planes_ == num_channels<View>::value );
+ BOOST_ASSERT( plane == num_channels<View>::value );
+ number_of_planes_ = num_channels<View>::value;
}
template <class View>
@@ -292,6 +298,7 @@
//------------------------------------------------------------------------------
} // namespace detail
+//------------------------------------------------------------------------------
class libtiff_image;
@@ -403,9 +410,9 @@
typedef detail::full_format_t full_format_t;
public:
- point2<std::ptrdiff_t> dimensions() const
+ point2<uint32> dimensions() const
{
- return point2<std::ptrdiff_t>( get_field<uint32>( TIFFTAG_IMAGEWIDTH ), get_field<uint32>( TIFFTAG_IMAGELENGTH ) );
+ return point2<uint32>( get_field<uint32>( TIFFTAG_IMAGEWIDTH ), get_field<uint32>( TIFFTAG_IMAGELENGTH ) );
}
protected:
@@ -429,9 +436,9 @@
template <typename T1, typename T2>
std::pair<T1, T2> get_field( ttag_t const tag, int & cumulative_result ) const
{
- std::pair<T1, T2> value;
- cumulative_result &= ::TIFFGetFieldDefaulted( &lib_object(), tag, &value.first, &value.second );
- return value;
+ T1 first; T2 second; // avoid the std::pair default constructor
+ cumulative_result &= ::TIFFGetFieldDefaulted( &lib_object(), tag, &first, &second );
+ return std::pair<T1, T2>( first, second );
}
static std::size_t cached_format_size( backend_traits<libtiff_image>::format_t const format )
Modified: sandbox/gil/boost/gil/extension/io2/backends/libtiff/reader.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/libtiff/reader.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/libtiff/reader.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,7 +5,7 @@
///
/// LibTIFF reader
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
@@ -71,6 +71,7 @@
//------------------------------------------------------------------------------
} // namespace detail
+//------------------------------------------------------------------------------
class libtiff_image::native_reader
@@ -110,10 +111,10 @@
std::size_t tile_size () const { return ::TIFFTileSize ( &lib_object() ); }
std::size_t tile_row_size() const { return ::TIFFTileRowSize( &lib_object() ); }
- point2<std::ptrdiff_t> tile_dimensions() const
+ point2<uint32> tile_dimensions() const
{
BOOST_ASSERT( can_do_tile_access() );
- return point2<std::ptrdiff_t>
+ return point2<uint32>
(
get_field<uint32>( TIFFTAG_TILEWIDTH ),
get_field<uint32>( TIFFTAG_TILELENGTH )
@@ -203,7 +204,15 @@
full_format_t const result =
{
- LIBTIFF_FORMAT( samples_per_pixel, bits_per_sample, ( sample_format == SAMPLEFORMAT_VOID ) ? SAMPLEFORMAT_UINT : sample_format, planar_configuration, photometric, ink_set )
+ LIBTIFF_FORMAT
+ (
+ samples_per_pixel,
+ bits_per_sample,
+ ( sample_format == SAMPLEFORMAT_VOID ) ? SAMPLEFORMAT_UINT : sample_format,
+ planar_configuration,
+ photometric,
+ ink_set
+ )
};
return result;
}
@@ -229,7 +238,7 @@
: boost::noncopyable
#endif // __GNUC__
{
- tile_setup_t( native_reader const & source, point2<std::ptrdiff_t> const & dimensions, offset_t const offset, bool const nptcc )
+ tile_setup_t( native_reader const & source, point2<uint32> const & dimensions, offset_t const offset, bool const nptcc )
:
tile_height ( source.get_field<uint32>( TIFFTAG_TILELENGTH ) ),
tile_width ( source.get_field<uint32>( TIFFTAG_TILEWIDTH ) ),
@@ -289,7 +298,7 @@
unsigned int const modulo( dividend % divisor );
return ( modulo != 0 ) ? modulo : divisor;
}
- };
+ }; // struct tile_setup_t
struct skip_row_results_t
{
@@ -843,7 +852,7 @@
private:
full_format_t const format_;
-};
+}; // class libtiff_image::native_reader
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/backends/wic/backend.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/wic/backend.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/wic/backend.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,9 +5,10 @@
///
/// Base IO interface WIC implementation.
///
-/// Copyright (c) Domagoj Saric 2010.
+/// Copyright (c) 2010.-2013. Domagoj Saric
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -195,7 +196,7 @@
private:
aligned_storage<sizeof( wic_roi ), alignment_of<wic_roi>::value>::type optional_roi_;
-};
+}; // struct wic_view_data_t
template <template <typename Handle> class IODeviceStream, class BackendWriter>
@@ -250,7 +251,7 @@
BOOST_STATIC_CONSTANT( unsigned int, desired_alignment = sizeof( void * ) );
BOOST_STATIC_CONSTANT( bool , builtin_conversion = true );
-};
+}; // struct backend_traits<wic_image>
////////////////////////////////////////////////////////////////////////////////
@@ -277,7 +278,7 @@
public: // Low-level (row, strip, tile) access
static bool can_do_roi_access() { return true; }
-};
+}; // class wic_image
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/backends/wic/extern_lib_guard.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/wic/extern_lib_guard.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/wic/extern_lib_guard.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,18 +5,19 @@
///
/// WIC extern lib guard
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
/// For more information, see http://www.boost.org
////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------
-#pragma once
#ifndef extern_lib_guard_hpp__A28436C0_3FEA_4850_9287_656BAAAD6259
#define extern_lib_guard_hpp__A28436C0_3FEA_4850_9287_656BAAAD6259
+#pragma once
//------------------------------------------------------------------------------
#include "boost/gil/extension/io2/backends/detail/extern_lib_guard.hpp"
#include "boost/gil/extension/io2/detail/io_error.hpp"
@@ -71,12 +72,12 @@
com_scoped_ptr( com_scoped_ptr const & source ) : baseCOMPtr_( source.baseCOMPtr_ ) { if ( baseCOMPtr_ ) baseCOMPtr_->AddRef(); }
com_scoped_ptr( IUnknown & source )
{
- //http://msdn.microsoft.com/en-us/library/ms682521(v=vs.85).aspx
- //http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
- //http://c2.com/cgi/wiki?QueryInterface
- //http://msdn.microsoft.com/en-us/library/ms810016
- //http://msdn.microsoft.com/en-us/library/dd542643(VS.85).aspx
- //http://en.wikipedia.org/wiki/Catastrophic_failure
+ // http://msdn.microsoft.com/en-us/library/ms682521(v=vs.85).aspx
+ // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
+ // http://c2.com/cgi/wiki?QueryInterface
+ // http://msdn.microsoft.com/en-us/library/ms810016
+ // http://msdn.microsoft.com/en-us/library/dd542643(VS.85).aspx
+ // http://en.wikipedia.org/wiki/Catastrophic_failure
BOOST_VERIFY
(
source.QueryInterface
@@ -116,7 +117,7 @@
private:
COMInterface * baseCOMPtr_;
-};
+}; // class com_scoped_ptr
////////////////////////////////////////////////////////////////////////////////
@@ -139,9 +140,24 @@
public:
creator()
{
+ #if BOOST_LIB_INIT( BOOST_GIL_EXTERNAL_LIB ) == BOOST_LIB_INIT_ASSUME
+ BOOST_ASSERT_MSG( !wic_factory::p_imaging_factory_, "WIC already initialised." );
+ #endif
+
HRESULT hr( ::CoInitializeEx( 0, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE | COINIT_SPEED_OVER_MEMORY ) );
if ( SUCCEEDED( hr ) )
- hr = wic_factory::p_imaging_factory_.create_instance( CLSID_WICImagingFactory );
+ {
+ #if BOOST_LIB_INIT( BOOST_GIL_EXTERNAL_LIB ) == BOOST_LIB_INIT_AUTO
+ if ( wic_factory::p_imaging_factory_ )
+ {
+ static_cast<IWICImagingFactory *>( wic_factory::p_imaging_factory_ )->AddRef();
+ }
+ else
+ #endif // BOOST_LIB_INIT( BOOST_GIL_EXTERNAL_LIB ) == BOOST_LIB_INIT_AUTO
+ {
+ hr = wic_factory::p_imaging_factory_.create_instance( CLSID_WICImagingFactory );
+ }
+ }
if ( FAILED( hr ) )
io_error( "Boost.GIL failed to load external library." ); //...zzz...duplicated...
@@ -155,11 +171,11 @@
wic_factory::p_imaging_factory_.release();
::CoUninitialize();
}
- };
+ }; // class creator
private:
static com_scoped_ptr<IWICImagingFactory> p_imaging_factory_;
-};
+}; // class wic_factory
// Implementation note:
// GCC supports the __declspec( selectany ) declarator for Windows targets
Modified: sandbox/gil/boost/gil/extension/io2/backends/wic/writer.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/backends/wic/writer.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/backends/wic/writer.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,9 +5,10 @@
///
/// WIC writer.
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -69,6 +70,8 @@
if ( SUCCEEDED( hr ) )
{
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ee719871(v=vs.85).aspx
+ // http://stackoverflow.com/questions/17711793/what-causes-iwicbitmapframeencodesetpixelformat-to-return-a-format-different-f
WICPixelFormatGUID formatGUID( view_data.format_ );
hr = frame().SetPixelFormat( &formatGUID );
if ( SUCCEEDED( hr ) )
@@ -136,7 +139,7 @@
private:
lib_object_t lib_object_;
-};
+}; // class wic_image::native_writer
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/detail/windows_shared_istreams.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/detail/windows_shared_istreams.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/detail/windows_shared_istreams.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -5,9 +5,10 @@
///
/// Windows IStream implementation(s) for the GIL.IO2 device concept.
///
-/// Copyright (c) Domagoj Saric 2010.-2011.
+/// Copyright (c) Domagoj Saric 2010.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -52,20 +53,20 @@
////////////////////////////////////////////////////////////////////////////////
///
-/// \class StreamBase
-/// -----------------
+/// \class stream_base
+/// ------------------
///
////////////////////////////////////////////////////////////////////////////////
-class __declspec( novtable ) StreamBase : public IStream, noncopyable
+class __declspec( novtable ) stream_base : public IStream, noncopyable
{
public:
- static void * operator new( std::size_t, void * const p_placeholder ) { return p_placeholder; }
+ static void * operator new( std::size_t, void * const p_placeholder ) { /*BF_ASSUME( p_placeholder );*/ return p_placeholder; }
#ifndef NDEBUG
protected:
- StreamBase() : ref_cnt_( 1 ) {}
- ~StreamBase() { BOOST_ASSERT( ref_cnt_ == 1 ); }
+ stream_base() : ref_cnt_( 1 ) {}
+ ~stream_base() { BOOST_ASSERT( ref_cnt_ == 1 ); }
#endif // NDEBUG
protected:
@@ -162,7 +163,7 @@
#ifndef NDEBUG
int ref_cnt_;
#endif // NDEBUG
-};
+}; // class stream_base
////////////////////////////////////////////////////////////////////////////////
@@ -173,7 +174,7 @@
////////////////////////////////////////////////////////////////////////////////
template <class Device>
-class __declspec( novtable ) device_stream_base : public StreamBase
+class __declspec( novtable ) device_stream_base : public stream_base
{
protected:
device_stream_base( typename Device::handle_t const handle ) : handle_( handle ) {}
@@ -199,7 +200,7 @@
protected:
typename Device::handle_t const handle_;
-};
+}; // class device_stream_base
////////////////////////////////////////////////////////////////////////////////
@@ -213,7 +214,7 @@
class input_device_stream : public device_stream_base<input_device<DeviceHandle> >
{
public:
- input_device_stream( DeviceHandle const handle ) : device_stream_base( file ) {}
+ input_device_stream( DeviceHandle const handle ) : device_stream_base( handle ) {}
private:
HRESULT STDMETHODCALLTYPE Read( void * const pv, ULONG const cb, ULONG * const pcbRead ) override
@@ -224,7 +225,7 @@
*pcbRead = size_read;
return ( size_read == cb ) ? S_OK : S_FALSE;
}
-};
+}; // class input_device_stream
////////////////////////////////////////////////////////////////////////////////
@@ -249,7 +250,7 @@
*pcbWritten = size_written;
return ( size_written == cb ) ? S_OK : S_FALSE;
}
-};
+}; // class output_device_stream
#pragma warning( pop )
@@ -260,20 +261,26 @@
///
////////////////////////////////////////////////////////////////////////////////
-struct __declspec( novtable ) istream_placeholder_helper : private StreamBase { void * handle; };
+struct __declspec( novtable ) istream_placeholder_helper : private stream_base { void * handle; };
typedef aligned_storage<sizeof( istream_placeholder_helper ), sizeof( void *)> istream_placeholder;
#ifdef NDEBUG
BOOST_STATIC_ASSERT( sizeof( istream_placeholder ) <= sizeof( void * ) * 2 /* vtable + handle */ );
#endif
-template <template <typename Handle> class IODeviceStream, class BackendWriter>
+template
+<
+ template <typename Handle> class IODeviceStream,
+ class BackendWriter
+>
class device_stream_wrapper
:
private istream_placeholder,
public BackendWriter
{
public:
+ //...mrmlj...placement new construction to avoid requiring specializing the
+ //...mrmlj...entire class on the Handle parameter...
template <class DeviceHandle>
device_stream_wrapper( DeviceHandle const handle )
:
@@ -293,7 +300,7 @@
{
BOOST_STATIC_ASSERT( sizeof( IODeviceStream<DeviceHandle> ) <= sizeof( istream_placeholder ) );
}
-};
+}; // class device_stream_wrapper
//------------------------------------------------------------------------------
} // namespace detail
Modified: sandbox/gil/boost/gil/extension/io2/devices/c_file_descriptor.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/devices/c_file_descriptor.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/devices/c_file_descriptor.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -3,9 +3,10 @@
/// \file c_file_descriptor.hpp
/// ---------------------------
///
-/// Copyright (c) Domagoj Saric 2011.
+/// Copyright (c) 2011.-2013. Domagoj Saric
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -68,33 +69,33 @@
static uintmax_t position_long( handle_t const handle )
{
- #ifdef BOOST_MSVC
- return /*std*/::_telli64( handle );
- #else
- return /*std*/::tell64 ( handle );
- #endif // BOOST_MSVC
+ #ifdef BOOST_MSVC
+ return /*std*/::_telli64( handle );
+ #else
+ return /*std*/::tell64 ( handle );
+ #endif // BOOST_MSVC
}
static std::size_t size( handle_t const handle )
{
- #ifdef BOOST_MSVC
- return /*std*/::_filelength( handle );
- #else
- struct stat file_status;
- BOOST_VERIFY( ::fstat( handle, &file_status ) == 0 );
- return file_status.st_size;
- #endif // BOOST_MSVC
+ #ifdef BOOST_MSVC
+ return /*std*/::_filelength( handle );
+ #else
+ struct stat file_status;
+ BOOST_VERIFY( ::fstat( handle, &file_status ) == 0 );
+ return file_status.st_size;
+ #endif // BOOST_MSVC
}
static uintmax_t size_long( handle_t const handle )
{
- #ifdef BOOST_MSVC
- return /*std*/::_filelengthi64( handle );
- #else
- struct stat64 file_status;
- BOOST_VERIFY( ::fstat64( handle, &file_status ) == 0 );
- return file_status.st_size;
- #endif // BOOST_MSVC
+ #ifdef BOOST_MSVC
+ return /*std*/::_filelengthi64( handle );
+ #else
+ struct stat64 file_status;
+ BOOST_VERIFY( ::fstat64( handle, &file_status ) == 0 );
+ return file_status.st_size;
+ #endif // BOOST_MSVC
}
static bool seek( seek_origin const origin, off_t offset, handle_t const handle )
@@ -104,13 +105,13 @@
static bool seek_long( seek_origin const origin, intmax_t offset, handle_t const handle )
{
- #ifdef BOOST_MSVC
- return /*std*/::_lseeki64( handle, offset, origin ) != 0;
- #else
- return /*std*/::lseeko ( handle, offset, origin ) != 0;
- #endif
+ #ifdef BOOST_MSVC
+ return /*std*/::_lseeki64( handle, offset, origin ) != 0;
+ #else
+ return /*std*/::lseeko ( handle, offset, origin ) != 0;
+ #endif
}
-};
+}; // struct device<c_file_descriptor_t>
template <>
@@ -126,10 +127,10 @@
static std::size_t read( void * p_data, std::size_t const size, handle_t const handle )
{
- int const result( /*std*/::read( handle, p_data, size ) );
+ std::size_t const result( /*std*/::read( handle, p_data, size ) );
return ( result >= 0 ) ? result : 0;
}
-};
+}; // struct input_device<c_file_descriptor_t>
template <>
@@ -145,19 +146,19 @@
static std::size_t write( void const * p_data, std::size_t const size, handle_t const handle )
{
- int const result( /*std*/::write( handle, p_data, size ) );
+ std::size_t const result( /*std*/::write( handle, p_data, size ) );
return ( result >= 0 ) ? result : 0;
}
static void flush( handle_t const handle )
{
- #ifdef BOOST_MSVC
- BOOST_VERIFY( /*std*/::_commit( handle ) == 0 );
- #else
- BOOST_VERIFY( /*std*/::fsync ( handle ) == 0 );
- #endif
+ #ifdef BOOST_MSVC
+ BOOST_VERIFY( /*std*/::_commit( handle ) == 0 );
+ #else
+ BOOST_VERIFY( /*std*/::fsync ( handle ) == 0 );
+ #endif
}
-};
+}; // struct output_device<c_file_descriptor_t>
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/devices/c_file_name.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/devices/c_file_name.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/devices/c_file_name.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -3,9 +3,10 @@
/// \file c_file_name.hpp
/// ---------------------
///
-/// Copyright (c) Domagoj Saric 2011.
+/// Copyright (c) Domagoj Saric 2011.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -30,13 +31,13 @@
{
//------------------------------------------------------------------------------
-
template <>
struct device<char const *> : device<c_file_descriptor_t>
{
static bool const auto_closes = true;
};
+
template <>
struct input_device<char const *>
:
@@ -56,7 +57,7 @@
input_device<c_file_descriptor_t>::handle_t transform( char const * /*p_file_name*/ ) const { return file_descriptor_; }
input_device<c_file_descriptor_t>::handle_t const file_descriptor_;
-};
+}; // struct input_device<char const *>
template <>
@@ -78,7 +79,7 @@
output_device<c_file_descriptor_t>::handle_t transform( char const * /*p_file_name*/ ) const { return file_descriptor_; }
output_device<c_file_descriptor_t>::handle_t const file_descriptor_;
-};
+}; // struct output_device<char const *>
//------------------------------------------------------------------------------
} // namespace io
Modified: sandbox/gil/boost/gil/extension/io2/devices/device.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/devices/device.hpp Sat Aug 10 15:19:02 2013 (r85289)
+++ sandbox/gil/boost/gil/extension/io2/devices/device.hpp 2013-08-10 17:30:57 EDT (Sat, 10 Aug 2013) (r85290)
@@ -3,9 +3,10 @@
/// \file device.hpp
/// ----------------
///
-/// Copyright (c) Domagoj Saric 2011.
+/// Copyright (c) Domagoj Saric 2011.-2013.
///
-/// Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+/// Use, modification and distribution is subject to the
+/// Boost Software License, Version 1.0.
/// (See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt)
///
@@ -63,8 +64,7 @@
io_error_if_not( condition, "Boost.GIL.IO failed to open output file." );
}
};
-}
-
+} // namespace detail
//------------------------------------------------------------------------------
} // namespace io
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