Skip to content

Commit

Permalink
refactor: Replace deprecated libtiff v4.3 typedefs with C99 fixed-siz…
Browse files Browse the repository at this point in the history
…e integers (#685)
  • Loading branch information
marco-langer authored Jun 25, 2022
1 parent b9e652d commit 151fd9c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
37 changes: 19 additions & 18 deletions include/boost/gil/extension/io/tiff/detail/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/gil/io/device.hpp>

#include <algorithm>
#include <cstdint>
#include <memory>
#include <sstream>
#include <type_traits>
Expand Down Expand Up @@ -192,7 +193,7 @@ class tiff_device_base
{
io_error_if( TIFFReadScanline( _tiff_file.get()
, reinterpret_cast< tdata_t >( &buffer.front() )
, (uint32) row
, static_cast<std::uint32_t>( row )
, plane ) == -1
, "Read error."
);
Expand All @@ -205,7 +206,7 @@ class tiff_device_base
{
io_error_if( TIFFReadScanline( _tiff_file.get()
, reinterpret_cast< tdata_t >( buffer )
, (uint32) row
, static_cast<std::uint32_t>( row )
, plane ) == -1
, "Read error."
);
Expand All @@ -221,9 +222,9 @@ class tiff_device_base
{
if( TIFFReadTile( _tiff_file.get()
, reinterpret_cast< tdata_t >( &buffer.front() )
, (uint32) x
, (uint32) y
, (uint32) z
, static_cast< std::uint32_t >( x )
, static_cast< std::uint32_t >( y )
, static_cast< std::uint32_t >( z )
, plane
) == -1 )
{
Expand All @@ -234,9 +235,9 @@ class tiff_device_base
}

template< typename Buffer >
void write_scaline( Buffer& buffer
, uint32 row
, tsample_t plane
void write_scaline( Buffer& buffer
, std::uint32_t row
, tsample_t plane
)
{
io_error_if( TIFFWriteScanline( _tiff_file.get()
Expand All @@ -248,9 +249,9 @@ class tiff_device_base
);
}

void write_scaline( byte_t* buffer
, uint32 row
, tsample_t plane
void write_scaline( byte_t* buffer
, std::uint32_t row
, tsample_t plane
)
{
io_error_if( TIFFWriteScanline( _tiff_file.get()
Expand All @@ -263,11 +264,11 @@ class tiff_device_base
}

template< typename Buffer >
void write_tile( Buffer& buffer
, uint32 x
, uint32 y
, uint32 z
, tsample_t plane
void write_tile( Buffer& buffer
, std::uint32_t x
, std::uint32_t y
, std::uint32_t z
, tsample_t plane
)
{
if( TIFFWriteTile( _tiff_file.get()
Expand Down Expand Up @@ -300,8 +301,8 @@ class tiff_device_base
)
{
bool result = true;
uint32 tw = static_cast< uint32 >( width );
uint32 th = static_cast< uint32 >( height );
std::uint32_t tw = static_cast< std::uint32_t >( width );
std::uint32_t th = static_cast< std::uint32_t >( height );

TIFFDefaultTileSize( _tiff_file.get()
, &tw
Expand Down
11 changes: 6 additions & 5 deletions include/boost/gil/extension/io/tiff/detail/write.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <boost/gil/io/detail/dynamic.hpp>

#include <algorithm>
#include <cstdint>
#include <string>
#include <type_traits>
#include <vector>
Expand Down Expand Up @@ -183,7 +184,7 @@ class writer< Device


this->_io_dev.write_scaline( row
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -211,7 +212,7 @@ class writer< Device


this->_io_dev.write_scaline( row
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -273,7 +274,7 @@ class writer< Device
);

this->_io_dev.write_scaline( row_addr
, (uint32) y
, static_cast<std::uint32_t>( y )
, 0
);

Expand Down Expand Up @@ -393,8 +394,8 @@ class writer< Device
}

this->_io_dev.write_tile( row
, static_cast< uint32 >( j )
, static_cast< uint32 >( i )
, static_cast< std::uint32_t >( j )
, static_cast< std::uint32_t >( i )
, 0
, 0
);
Expand Down

0 comments on commit 151fd9c

Please sign in to comment.