Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68010 - in sandbox/gil/boost/gil/extension/io2: . detail
From: dsaritz_at_[hidden]
Date: 2011-01-11 18:36:06


Author: psiha
Date: 2011-01-11 18:36:04 EST (Tue, 11 Jan 2011)
New Revision: 68010
URL: http://svn.boost.org/trac/boost/changeset/68010

Log:
GCC compilation error fixes and workarounds.
Text files modified:
   sandbox/gil/boost/gil/extension/io2/detail/io_error.hpp | 27 +++++++++++++++++----------
   sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp | 4 ++--
   sandbox/gil/boost/gil/extension/io2/libjpeg_image.hpp | 40 ++++++++++++++++++++--------------------
   sandbox/gil/boost/gil/extension/io2/libtiff_image.hpp | 36 ++++++++++++++++++------------------
   4 files changed, 57 insertions(+), 50 deletions(-)

Modified: sandbox/gil/boost/gil/extension/io2/detail/io_error.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/detail/io_error.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/detail/io_error.hpp 2011-01-11 18:36:04 EST (Tue, 11 Jan 2011)
@@ -33,20 +33,27 @@
 {
 //------------------------------------------------------------------------------
 
+#ifndef _MSC_VER
+ // Implementation note:
+ // GCC 4.6.0 chokes if this class is declared locally in io_error().
+ // (12.01.2011.) (Domagoj Saric)
+ class gil_io_error : public std::exception
+ {
+ public:
+ gil_io_error( char const * const description ) : description_( description ) {}
+ char const * what() const throw() { return description_; }
+ private:
+ char const * const description_;
+ };
+#endif
+
+// Assumes the description string is static/non-temporary
 inline BF_NORETURN void io_error( char const * const description )
 {
     #ifdef _MSC_VER
- throw_exception( std::exception( description, 0 ) ); // Assumes the description string is static/non-temporary
+ throw_exception( std::exception( description, 0 ) );
     #else
- class gil_io_error : public std::exception
- {
- public:
- gil_io_error( char const * const description ) : description_( description ) {}
- char const * what() const throw() { return description_; }
- private:
- char const * const description_;
- };
- throw_exception( gil_io_error( description ) );
+ throw_exception( gil_io_error( description ) );
     #endif // _MSC_VER
 }
 

Modified: sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/detail/memory_mapping.hpp 2011-01-11 18:36:04 EST (Tue, 11 Jan 2011)
@@ -224,9 +224,9 @@
 class memory_mapping
     :
     private writable_memory_chunk_t
- #ifndef __clang__
+ #ifndef __GNUC__
         ,private boost::noncopyable
- #endif // __clang__
+ #endif // __GNUC__
 {
 public:
     memory_mapping

Modified: sandbox/gil/boost/gil/extension/io2/libjpeg_image.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/libjpeg_image.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/libjpeg_image.hpp 2011-01-11 18:36:04 EST (Tue, 11 Jan 2011)
@@ -92,7 +92,7 @@
     struct for_compressor {};
 
 protected:
- libjpeg_base( for_decompressor ) throw(...)
+ libjpeg_base( for_decompressor ) throw ( ... )
     {
         initialize_error_handler();
         #ifndef BOOST_GIL_THROW_THROUGH_C_SUPPORTED
@@ -102,7 +102,7 @@
         jpeg_create_decompress( &decompressor() );
     }
 
- libjpeg_base( for_compressor ) throw(...)
+ libjpeg_base( for_compressor ) throw ( ... )
     {
         initialize_error_handler();
         #ifndef BOOST_GIL_THROW_THROUGH_C_SUPPORTED
@@ -167,7 +167,7 @@
         common().err = &jerr_;
     }
 
- static void __cdecl error_exit( j_common_ptr const p_cinfo )
+ static void BF_CDECL error_exit( j_common_ptr const p_cinfo )
     {
         #ifndef NDEBUG
             p_cinfo->err->output_message( p_cinfo );
@@ -176,11 +176,11 @@
         fatal_error_handler( p_cinfo );
     }
 
- static void __cdecl output_message( j_common_ptr /*p_cinfo*/ ) {}
- static void __cdecl emit_message ( j_common_ptr /*p_cinfo*/, int /*msg_level*/ ) {}
- static void __cdecl format_message( j_common_ptr /*p_cinfo*/, char * /*buffer*/ ) {}
+ static void BF_CDECL output_message( j_common_ptr /*p_cinfo*/ ) {}
+ static void BF_CDECL emit_message ( j_common_ptr /*p_cinfo*/, int /*msg_level*/ ) {}
+ static void BF_CDECL format_message( j_common_ptr /*p_cinfo*/, char * /*buffer*/ ) {}
 
- static void __cdecl reset_error_mgr( j_common_ptr const p_cinfo )
+ static void BF_CDECL reset_error_mgr( j_common_ptr const p_cinfo )
     {
         BOOST_ASSERT( p_cinfo->err->num_warnings == 0 );
         BOOST_ASSERT( p_cinfo->err->msg_code == 0 );
@@ -352,7 +352,7 @@
         destination_manager_.term_destination = &term_and_close_FILE_destination;
     }
 
- static void __cdecl init_FILE_destination( j_compress_ptr const p_cinfo )
+ static void BF_CDECL init_FILE_destination( j_compress_ptr const p_cinfo )
     {
         libjpeg_writer & writer( get_writer( p_cinfo ) );
 
@@ -375,7 +375,7 @@
             fatal_error_handler( &common() );
     }
     
- static boolean __cdecl empty_FILE_buffer( j_compress_ptr const p_cinfo )
+ static boolean BF_CDECL empty_FILE_buffer( j_compress_ptr const p_cinfo )
     {
         libjpeg_writer & writer( get_writer( p_cinfo ) );
         writer.write_FILE_bytes( writer.write_buffer_.size() );
@@ -383,7 +383,7 @@
         return true;
     }
 
- static void __cdecl term_FILE_destination( j_compress_ptr const p_cinfo )
+ static void BF_CDECL term_FILE_destination( j_compress_ptr const p_cinfo )
     {
         libjpeg_writer & writer( get_writer( p_cinfo ) );
 
@@ -393,7 +393,7 @@
     }
 
     // Ensure that jpeg_finish_compress() is called so that this gets called...
- static void __cdecl term_and_close_FILE_destination( j_compress_ptr const p_cinfo )
+ static void BF_CDECL term_and_close_FILE_destination( j_compress_ptr const p_cinfo )
     {
         term_FILE_destination( p_cinfo );
         BOOST_VERIFY( /*std*/::fclose( static_cast<FILE *>( get_writer( p_cinfo ).compressor().client_data ) ) == 0 );
@@ -863,7 +863,7 @@
     }
 
 
- static void __cdecl init_FILE_source( j_decompress_ptr const p_cinfo )
+ static void BF_CDECL init_FILE_source( j_decompress_ptr const p_cinfo )
     {
         libjpeg_image & reader( get_reader( p_cinfo ) );
 
@@ -871,7 +871,7 @@
         reader.source_manager_.bytes_in_buffer = 0;
     }
 
- static boolean __cdecl fill_FILE_buffer( j_decompress_ptr const p_cinfo )
+ static boolean BF_CDECL fill_FILE_buffer( j_decompress_ptr const p_cinfo )
     {
         libjpeg_image & reader( get_reader( p_cinfo ) );
 
@@ -902,7 +902,7 @@
         return true;
     }
 
- static void __cdecl skip_FILE_data( j_decompress_ptr const p_cinfo, long num_bytes )
+ static void BF_CDECL skip_FILE_data( j_decompress_ptr const p_cinfo, long num_bytes )
     {
         libjpeg_image & reader( get_reader( p_cinfo ) );
 
@@ -920,28 +920,28 @@
         }
     }
 
- static void __cdecl term_FILE_source( j_decompress_ptr /*p_cinfo*/ )
+ static void BF_CDECL term_FILE_source( j_decompress_ptr /*p_cinfo*/ )
     {
     }
 
     // Ensure that jpeg_finish_decompress() is called so that this gets called...
- static void __cdecl term_and_close_FILE_source( j_decompress_ptr const p_cinfo )
+ static void BF_CDECL term_and_close_FILE_source( j_decompress_ptr const p_cinfo )
     {
         term_FILE_source( p_cinfo );
         BOOST_VERIFY( /*std*/::fclose( static_cast<FILE *>( get_reader( p_cinfo ).decompressor().client_data ) ) == 0 );
     }
 
- static void __cdecl init_memory_chunk_source( j_decompress_ptr /*p_cinfo*/ )
+ static void BF_CDECL init_memory_chunk_source( j_decompress_ptr /*p_cinfo*/ )
     {
     }
 
- static boolean __cdecl fill_memory_chunk_buffer( j_decompress_ptr /*p_cinfo*/ )
+ static boolean BF_CDECL fill_memory_chunk_buffer( j_decompress_ptr /*p_cinfo*/ )
     {
         BF_UNREACHABLE_CODE
         return true;
     }
 
- static void __cdecl skip_memory_chunk_data( j_decompress_ptr const p_cinfo, long num_bytes )
+ static void BF_CDECL skip_memory_chunk_data( j_decompress_ptr const p_cinfo, long num_bytes )
     {
         libjpeg_image & reader( get_reader( p_cinfo ) );
 
@@ -950,7 +950,7 @@
         reader.source_manager_.bytes_in_buffer -= num_bytes;
     }
 
- static void __cdecl term_memory_chunk_source( j_decompress_ptr /*p_cinfo*/ )
+ static void BF_CDECL term_memory_chunk_source( j_decompress_ptr /*p_cinfo*/ )
     {
     }
 

Modified: sandbox/gil/boost/gil/extension/io2/libtiff_image.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/libtiff_image.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/libtiff_image.hpp 2011-01-11 18:36:04 EST (Tue, 11 Jan 2011)
@@ -685,9 +685,9 @@
     friend class base_t;
 
     struct tile_setup_t
- #ifndef __clang__
+ #ifndef __GNUC__
             : boost::noncopyable
- #endif // __clang__
+ #endif // __GNUC__
     {
         tile_setup_t( libtiff_image const & source, point2<std::ptrdiff_t> const & dimensions, offset_t const offset, bool const nptcc )
             :
@@ -878,19 +878,19 @@
                 mpl::identity<MyView>
>::type::value_type my_pixel_t;
 
- bool const nondirect_planar_to_contig_conversion
- (
+ typedef mpl::bool_
+ <
              is_planar<MyView >::value &&
             !is_planar<original_target_view_t>::value &&
             (
                 !is_same<typename color_space_type <MyView>::type, typename color_space_type <original_target_view_t>::type>::value ||
                 !is_same<typename channel_mapping_type<MyView>::type, typename channel_mapping_type<original_target_view_t>::type>::value
             )
- );
+ > nondirect_planar_to_contig_conversion_t;
 
         cumulative_result result;
 
- unsigned int const number_of_planes( is_planar<MyView>::value ? num_channels<MyView>::value : 1 );
+ typedef mpl::int_<is_planar<MyView>::value ? num_channels<MyView>::value : 1> number_of_planes_t;
 
         dimensions_t const & dimensions( original_view( view ).dimensions() );
 
@@ -905,13 +905,13 @@
                 *this,
                 dimensions,
                 get_offset<offset_t>( view ),
- nondirect_planar_to_contig_conversion
+ nondirect_planar_to_contig_conversion_t::value
             );
 
- unsigned int const tiles_per_plane( setup.number_of_tiles / number_of_planes );
- ttile_t current_tile ( 0 );
+ unsigned int const tiles_per_plane( setup.number_of_tiles / number_of_planes_t::value );
+ ttile_t current_tile ( 0 );
 
- if ( nondirect_planar_to_contig_conversion )
+ if ( nondirect_planar_to_contig_conversion_t::value )
             {
                 // For NPTCC there is no need for target view
                 // planar<->non-planar adjustment because here we read whole
@@ -924,7 +924,7 @@
                     (
                         setup.p_tile_buffer.get(),
                         setup.tile_size_bytes,
- mpl::int_<number_of_planes>()
+ number_of_planes_t()
                     )
                 );
 
@@ -935,7 +935,7 @@
                     bool const last_row_tile ( !--setup.current_row_tiles_remaining );
                     unsigned int const this_tile_width( last_row_tile ? setup.last_row_tile_width : setup.tile_width );
 
- for ( unsigned int channel_tile( 0 ); channel_tile < number_of_planes; ++channel_tile )
+ for ( unsigned int channel_tile( 0 ); channel_tile < number_of_planes_t::value; ++channel_tile )
                     {
                         ttile_t const raw_tile_number( current_tile + ( channel_tile * tiles_per_plane ) );
                         result.accumulate_equal
@@ -989,7 +989,7 @@
                 for
                 (
                     unsigned int plane( 0 ), current_plane_end_tile( tiles_per_plane );
- plane < number_of_planes;
+ plane < number_of_planes_t::value;
                     ++plane, current_plane_end_tile += tiles_per_plane
                 )
                 {
@@ -1055,9 +1055,9 @@
         // Striped
         ////////////////////////////////////////////////////////////////////////
         {
- scanline_buffer_t<my_pixel_t> const scanline_buffer( *this, mpl::bool_<nondirect_planar_to_contig_conversion>() );
+ scanline_buffer_t<my_pixel_t> const scanline_buffer( *this, nondirect_planar_to_contig_conversion_t::value() );
 
- if ( nondirect_planar_to_contig_conversion )
+ if ( nondirect_planar_to_contig_conversion_t::value )
             {
                 typename original_target_view_t::y_iterator p_target( original_view( view ).y_at( 0, 0 ) );
                 unsigned int row ( get_offset<offset_t>( view ) );
@@ -1069,13 +1069,13 @@
                     (
                         scanline_buffer.begin(),
                         dimensions.x,
- mpl::int_<number_of_planes>()
+ number_of_planes_t()
                     )
                 );
 
                 while ( row != target_row )
                 {
- for ( unsigned int plane( 0 ); plane < number_of_planes; ++plane )
+ for ( unsigned int plane( 0 ); plane < number_of_planes_t::value; ++plane )
                     {
                         tdata_t const p_buffer( &(*buffer_iterator)[ plane ] );
                         //...zzz...yup...not the most efficient thing in the universe...
@@ -1096,7 +1096,7 @@
             }
             else
             {
- for ( unsigned int plane( 0 ); plane < number_of_planes; ++plane )
+ for ( unsigned int plane( 0 ); plane < number_of_planes_t::value; ++plane )
                 {
                     if ( is_offset_view<TargetView>::value )
                         skip_to_row( get_offset<offset_t>( view ), plane, scanline_buffer.begin(), result );


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