Ticket #4014: boost_gil_gcc_warning_cleanup.diff
File boost_gil_gcc_warning_cleanup.diff, 18.2 KB (added by , 13 years ago) |
---|
-
boost/gil/locator.hpp
309 309 310 310 private: 311 311 template <typename X> friend class memory_based_2d_locator; 312 std::ptrdiff_t offset(x_coord_t x, y_coord_t y) const { return y*row_size() +x*pixel_size(); }312 std::ptrdiff_t offset(x_coord_t p_x, y_coord_t p_y) const { return p_y*row_size() + p_x*pixel_size(); } 313 313 StepIterator _p; 314 314 }; 315 315 -
boost/gil/virtual_locator.hpp
53 53 } 54 54 }; 55 55 56 virtual_2d_locator(const point_t& p=point_t(0,0), const point_t& step=point_t(1,1), const deref_fn_t& d=deref_fn_t()) : _p(p,step,d) {}56 virtual_2d_locator(const point_t& p=point_t(0,0), const point_t& p_step=point_t(1,1), const deref_fn_t& d=deref_fn_t()) : _p(p,p_step,d) {} 57 57 template <typename D, bool TR> virtual_2d_locator(const virtual_2d_locator<D,TR>& loc, coord_t y_step) 58 58 : _p(loc.pos(), point_t(loc.step().x,loc.step().y*y_step), loc.deref_fn()) {} 59 59 template <typename D, bool TR> virtual_2d_locator(const virtual_2d_locator<D,TR>& loc, coord_t x_step, coord_t y_step, bool transpose=false) -
boost/gil/image_view.hpp
101 101 template <typename View> image_view(const View& iv) : _dimensions(iv.dimensions()), _pixels(iv.pixels()) {} 102 102 103 103 template <typename L2> image_view(const point_t& sz , const L2& loc) : _dimensions(sz), _pixels(loc) {} 104 template <typename L2> image_view(coord_t width, coord_t height, const L2& loc) : _dimensions(x_coord_t(width),y_coord_t(height)), _pixels(loc) {}104 template <typename L2> image_view(coord_t p_width, coord_t p_height, const L2& loc) : _dimensions(x_coord_t(p_width),y_coord_t(p_height)), _pixels(loc) {} 105 105 106 106 template <typename View> image_view& operator=(const View& iv) { _pixels=iv.pixels(); _dimensions=iv.dimensions(); return *this; } 107 107 image_view& operator=(const image_view& iv) { _pixels=iv.pixels(); _dimensions=iv.dimensions(); return *this; } -
boost/gil/position_iterator.hpp
52 52 typedef typename Deref::argument_type point_t; 53 53 54 54 position_iterator() {} 55 position_iterator(const point_t& p, const point_t& step, const Deref& d) : _p(p), _step(step), _d(d) {}55 position_iterator(const point_t& p, const point_t& p_step, const Deref& d) : _p(p), _step(p_step), _d(d) {} 56 56 57 57 position_iterator(const position_iterator& p) : _p(p._p), _step(p._step), _d(p._d) {} 58 58 template <typename D> position_iterator(const position_iterator<D,Dim>& p) : _p(p._p), _step(p._step), _d(p._d) {} -
boost/gil/iterator_from_2d.hpp
78 78 x_iterator& x() { return _p.x(); } 79 79 80 80 iterator_from_2d(){} 81 iterator_from_2d(const Loc2& p, std::ptrdiff_t width, std::ptrdiff_t x=0, std::ptrdiff_t y=0) : _coords(x,y), _width(width), _p(p) {}81 iterator_from_2d(const Loc2& p, std::ptrdiff_t p_width, std::ptrdiff_t p_x=0, std::ptrdiff_t p_y=0) : _coords(p_x,p_y), _width(p_width), _p(p) {} 82 82 iterator_from_2d(const iterator_from_2d& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {} 83 83 template <typename Loc> iterator_from_2d(const iterator_from_2d<Loc>& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {} 84 84 -
boost/gil/pixel_iterator_adaptor.hpp
62 62 dereference_iterator_adaptor() {} 63 63 template <typename Iterator1> 64 64 dereference_iterator_adaptor(const dereference_iterator_adaptor<Iterator1,DFn>& dit) : parent_t(dit.base()), _deref_fn(dit._deref_fn) {} 65 dereference_iterator_adaptor(Iterator it, DFn deref_fn=DFn()) : parent_t(it), _deref_fn(deref_fn) {}65 dereference_iterator_adaptor(Iterator it, DFn p_deref_fn=DFn()) : parent_t(it), _deref_fn(p_deref_fn) {} 66 66 template <typename Iterator1, typename DFn1> 67 67 dereference_iterator_adaptor(const dereference_iterator_adaptor<Iterator1,DFn1>& it) : parent_t(it.base()), _deref_fn(it._deref_fn) {} 68 68 /// For some reason operator[] provided by iterator_facade returns a custom class that is convertible to reference -
boost/gil/channel.hpp
482 482 typedef const packed_dynamic_channel_reference<BitField,NumBits,true> mutable_reference; 483 483 typedef typename parent_t::integer_t integer_t; 484 484 485 packed_dynamic_channel_reference(const void* data_ptr, unsigned first_bit) : parent_t(data_ptr), _first_bit(first_bit) {}485 packed_dynamic_channel_reference(const void* data_ptr, unsigned p_first_bit) : parent_t(data_ptr), _first_bit(p_first_bit) {} 486 486 packed_dynamic_channel_reference(const const_reference& ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {} 487 487 packed_dynamic_channel_reference(const mutable_reference& ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {} 488 488 … … 510 510 typedef const packed_dynamic_channel_reference<BitField,NumBits,true> mutable_reference; 511 511 typedef typename parent_t::integer_t integer_t; 512 512 513 packed_dynamic_channel_reference(void* data_ptr, unsigned first_bit) : parent_t(data_ptr), _first_bit(first_bit) {}513 packed_dynamic_channel_reference(void* data_ptr, unsigned p_first_bit) : parent_t(data_ptr), _first_bit(p_first_bit) {} 514 514 packed_dynamic_channel_reference(const packed_dynamic_channel_reference& ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {} 515 515 516 516 const packed_dynamic_channel_reference& operator=(integer_t value) const { assert(value<=parent_t::max_val); set_unsafe(value); return *this; } -
boost/gil/bit_aligned_pixel_reference.hpp
54 54 55 55 public: 56 56 bit_range() : _current_byte(NULL), _bit_offset(0) {} 57 bit_range(byte_t* current_byte, int bit_offset) : _current_byte(current_byte), _bit_offset(bit_offset) { assert(bit_offset>=0 &&bit_offset<8); }57 bit_range(byte_t* p_current_byte, int p_bit_offset) : _current_byte(p_current_byte), _bit_offset(p_bit_offset) { assert(p_bit_offset>=0 && p_bit_offset<8); } 58 58 59 59 bit_range(const bit_range& br) : _current_byte(br._current_byte), _bit_offset(br._bit_offset) {} 60 60 template <bool M> bit_range(const bit_range<RangeSize,M>& br) : _current_byte(br._current_byte), _bit_offset(br._bit_offset) {} … … 135 135 136 136 bit_aligned_pixel_reference(){} 137 137 bit_aligned_pixel_reference(data_ptr_t data_ptr, int bit_offset) : _bit_range(data_ptr, bit_offset) {} 138 explicit bit_aligned_pixel_reference(const bit_range_t& bit_range) : _bit_range(bit_range) {}138 explicit bit_aligned_pixel_reference(const bit_range_t& p_bit_range) : _bit_range(p_bit_range) {} 139 139 template <bool IsMutable2> bit_aligned_pixel_reference(const bit_aligned_pixel_reference<BitField,ChannelBitSizes,Layout,IsMutable2>& p) : _bit_range(p._bit_range) {} 140 140 141 141 // Grayscale references can be constructed from the channel reference -
boost/gil/image.hpp
68 68 _memory(0), _align_in_bytes(alignment), _alloc(alloc_in) {} 69 69 70 70 // Create with dimensions and optional initial value and alignment 71 image(const point_t& dimensions,71 image(const point_t& p_dimensions, 72 72 std::size_t alignment=0, 73 73 const Alloc alloc_in = Alloc()) : _memory(0), _align_in_bytes(alignment), _alloc(alloc_in) { 74 allocate_and_default_construct( dimensions);74 allocate_and_default_construct(p_dimensions); 75 75 } 76 image(x_coord_t width, y_coord_theight,76 image(x_coord_t p_width, y_coord_t p_height, 77 77 std::size_t alignment=0, 78 78 const Alloc alloc_in = Alloc()) : _memory(0), _align_in_bytes(alignment), _alloc(alloc_in) { 79 allocate_and_default_construct(point_t( width,height));79 allocate_and_default_construct(point_t(p_width,p_height)); 80 80 } 81 image(const point_t& dimensions,81 image(const point_t& p_dimensions, 82 82 const Pixel& p_in, 83 83 std::size_t alignment, 84 84 const Alloc alloc_in = Alloc()) : 85 85 _memory(0), _align_in_bytes(alignment), _alloc(alloc_in) { 86 allocate_and_fill( dimensions, p_in);86 allocate_and_fill(p_dimensions, p_in); 87 87 } 88 image(x_coord_t width, y_coord_theight,88 image(x_coord_t p_width, y_coord_t p_height, 89 89 const Pixel& p_in, 90 90 std::size_t alignment, 91 91 const Alloc alloc_in = Alloc()) : 92 92 _memory(0), _align_in_bytes(alignment), _alloc(alloc_in) { 93 allocate_and_fill(point_t( width,height),p_in);93 allocate_and_fill(point_t(p_width,p_height),p_in); 94 94 } 95 95 96 96 image(const image& img) : … … 146 146 swap(tmp); 147 147 } 148 148 } 149 void recreate(x_coord_t width, y_coord_theight, std::size_t alignment=0, const Alloc alloc_in = Alloc()) {150 recreate(point_t( width,height),alignment,alloc_in);149 void recreate(x_coord_t p_width, y_coord_t p_height, std::size_t alignment=0, const Alloc alloc_in = Alloc()) { 150 recreate(point_t(p_width,p_height),alignment,alloc_in); 151 151 } 152 152 void recreate(const point_t& dims, 153 153 const Pixel& p_in, std::size_t alignment, const Alloc alloc_in = Alloc()) { … … 156 156 swap(tmp); 157 157 } 158 158 } 159 void recreate(x_coord_t width, y_coord_theight,159 void recreate(x_coord_t p_width, y_coord_t p_height, 160 160 const Pixel& p_in, std::size_t alignment, const Alloc alloc_in = Alloc()) { 161 recreate(point_t( width,height),p_in,alignment,alloc_in);161 recreate(point_t(p_width,p_height),p_in,alignment,alloc_in); 162 162 } 163 163 164 164 view_t _view; // contains pointer to the pixels, the image size and ways to navigate pixels … … 167 167 std::size_t _align_in_bytes; 168 168 allocator_type _alloc; 169 169 170 void allocate_and_default_construct(const point_t& dimensions) {170 void allocate_and_default_construct(const point_t& p_dimensions) { 171 171 try { 172 allocate_( dimensions,mpl::bool_<IsPlanar>());172 allocate_(p_dimensions,mpl::bool_<IsPlanar>()); 173 173 default_construct_pixels(_view); 174 } catch(...) { deallocate( dimensions); throw; }174 } catch(...) { deallocate(p_dimensions); throw; } 175 175 } 176 176 177 void allocate_and_fill(const point_t& dimensions, const Pixel& p_in) {177 void allocate_and_fill(const point_t& p_dimensions, const Pixel& p_in) { 178 178 try { 179 allocate_( dimensions,mpl::bool_<IsPlanar>());179 allocate_(p_dimensions,mpl::bool_<IsPlanar>()); 180 180 uninitialized_fill_pixels(_view, p_in); 181 } catch(...) { deallocate( dimensions); throw; }181 } catch(...) { deallocate(p_dimensions); throw; } 182 182 } 183 183 184 184 template <typename View> 185 void allocate_and_copy(const point_t& dimensions, const View& v) {185 void allocate_and_copy(const point_t& p_dimensions, const View& v) { 186 186 try { 187 allocate_( dimensions,mpl::bool_<IsPlanar>());187 allocate_(p_dimensions,mpl::bool_<IsPlanar>()); 188 188 uninitialized_copy_pixels(v,_view); 189 } catch(...) { deallocate( dimensions); throw; }189 } catch(...) { deallocate(p_dimensions); throw; } 190 190 } 191 191 192 void deallocate(const point_t& dimensions) {193 if (_memory) _alloc.deallocate(_memory, total_allocated_size_in_bytes( dimensions));192 void deallocate(const point_t& p_dimensions) { 193 if (_memory) _alloc.deallocate(_memory, total_allocated_size_in_bytes(p_dimensions)); 194 194 } 195 195 196 std::size_t total_allocated_size_in_bytes(const point_t& dimensions) const {197 std::size_t size_in_units = get_row_size_in_memunits( dimensions.x)*dimensions.y;196 std::size_t total_allocated_size_in_bytes(const point_t& p_dimensions) const { 197 std::size_t size_in_units = get_row_size_in_memunits(p_dimensions.x)*p_dimensions.y; 198 198 if (IsPlanar) 199 199 size_in_units = size_in_units*num_channels<view_t>::value; 200 200 … … 203 203 + (_align_in_bytes>0 ? _align_in_bytes-1:0); // add extra padding in case we need to align the first image pixel 204 204 } 205 205 206 std::size_t get_row_size_in_memunits(x_coord_t width) const { // number of units per row207 std::size_t size_in_memunits = width*memunit_step(typename view_t::x_iterator());206 std::size_t get_row_size_in_memunits(x_coord_t p_width) const { // number of units per row 207 std::size_t size_in_memunits = p_width*memunit_step(typename view_t::x_iterator()); 208 208 if (_align_in_bytes>0) { 209 209 std::size_t alignment_in_memunits=_align_in_bytes*byte_to_memunit<typename view_t::x_iterator>::value; 210 210 return align(size_in_memunits, alignment_in_memunits); … … 212 212 return size_in_memunits; 213 213 } 214 214 215 void allocate_(const point_t& dimensions, mpl::false_) { // if it throws and _memory!=0 the client must deallocate _memory216 _memory=_alloc.allocate(total_allocated_size_in_bytes( dimensions));215 void allocate_(const point_t& p_dimensions, mpl::false_) { // if it throws and _memory!=0 the client must deallocate _memory 216 _memory=_alloc.allocate(total_allocated_size_in_bytes(p_dimensions)); 217 217 unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory; 218 _view=view_t( dimensions,typename view_t::locator(typename view_t::x_iterator(tmp),get_row_size_in_memunits(dimensions.x)));218 _view=view_t(p_dimensions,typename view_t::locator(typename view_t::x_iterator(tmp),get_row_size_in_memunits(p_dimensions.x))); 219 219 } 220 220 221 void allocate_(const point_t& dimensions, mpl::true_) { // if it throws and _memory!=0 the client must deallocate _memory222 std::size_t row_size=get_row_size_in_memunits( dimensions.x);223 std::size_t plane_size=row_size* dimensions.y;224 _memory=_alloc.allocate(total_allocated_size_in_bytes( dimensions));221 void allocate_(const point_t& p_dimensions, mpl::true_) { // if it throws and _memory!=0 the client must deallocate _memory 222 std::size_t row_size=get_row_size_in_memunits(p_dimensions.x); 223 std::size_t plane_size=row_size*p_dimensions.y; 224 _memory=_alloc.allocate(total_allocated_size_in_bytes(p_dimensions)); 225 225 unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory; 226 226 typename view_t::x_iterator first; 227 227 for (int i=0; i<num_channels<view_t>::value; ++i) { 228 228 dynamic_at_c(first,i) = (typename channel_type<view_t>::type*)tmp; 229 229 memunit_advance(dynamic_at_c(first,i), plane_size*i); 230 230 } 231 _view=view_t( dimensions, typename view_t::locator(first, row_size));231 _view=view_t(p_dimensions, typename view_t::locator(first, row_size)); 232 232 } 233 233 }; 234 234 -
boost/gil/step_iterator.hpp
133 133 struct memunit_step_fn { 134 134 typedef std::ptrdiff_t difference_type; 135 135 136 memunit_step_fn(difference_type step=memunit_step(Iterator())) : _step(step) {}136 memunit_step_fn(difference_type p_step=memunit_step(Iterator())) : _step(p_step) {} 137 137 138 138 difference_type difference(const Iterator& it1, const Iterator& it2) const { return memunit_distance(it1,it2)/_step; } 139 139 void advance(Iterator& it, difference_type d) const { memunit_advance(it,d*_step); } 140 140 difference_type step() const { return _step; } 141 141 142 void set_step(std::ptrdiff_t step) { _step=step; }142 void set_step(std::ptrdiff_t p_step) { _step=p_step; } 143 143 private: 144 144 GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept) 145 145 difference_type _step; -
boost/gil/extension/io/io_error.hpp
24 24 25 25 namespace boost { namespace gil { 26 26 27 #if BOOST_WORKAROUND(__GNUC__, >= 3) 28 inline void io_error(const char* descr) __attribute__((noreturn)); 29 #endif 27 30 inline void io_error(const char* descr) { throw std::ios_base::failure(descr); } 28 31 inline void io_error_if(bool expr, const char* descr="") { if (expr) io_error(descr); } 29 32 -
boost/gil/algorithm.hpp
197 197 gil_function_requires<PixelLocatorConcept<IL> >(); 198 198 gil_function_requires<MutablePixelIteratorConcept<O> >(); 199 199 while (n>0) { 200 typedef typename iterator_from_2d<IL>::difference_type diff_t;201 diff_t l=src.width()-src.x_pos();202 diff_t numToCopy=(n<l ? n:l);200 typedef typename iterator_from_2d<IL>::difference_type iter_diff_t; 201 iter_diff_t l=src.width()-src.x_pos(); 202 iter_diff_t numToCopy=(n<l ? n:l); 203 203 detail::copy_n(src.x(), numToCopy, dst); 204 204 dst+=numToCopy; 205 205 src+=numToCopy;