1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Description: Avoid deprecated way of checking system endianness
According to file /usr/include/boost/predef/detail/endian_compat.h,
“[t]he use of BOOST_*_ENDIAN and BOOST_BYTE_ORDER is deprecated. Please
include <boost/predef/other/endian.h> and use BOOST_ENDIAN_*_BYTE
instead.”
.
This patch follows this recommendation.
Author: Rafael Laboissière <[email protected]>
Bug-Debian: https://bugs.debian.org/975443
Forwarded: https://github.com/mbillingr/libgdf/pull/6
Last-Update: 2020-12-31
--- libgdf-0.1.3.orig/libgdf/include/GDF/Types.h
libgdf-0.1.3/libgdf/include/GDF/Types.h
@@ -21,7 21,7 @@
#include "Exceptions.h"
#include <boost/cstdint.hpp>
-#include <boost/detail/endian.hpp>
#include <boost/predef/other/endian.h>
#include <iostream>
namespace gdf
@@ -74,9 74,9 @@ namespace gdf
template<typename T>
void writeLittleEndian( std::ostream &out, T item )
{
-#if defined(BOOST_LITTLE_ENDIAN)
#if BOOST_ENDIAN_LITTLE_BYTE
out.write( reinterpret_cast<const char*>(&item), sizeof(item) );
-#elif defined(BOOST_BIG_ENDIAN)
#elif BOOST_ENDIAN_BIG_BYTE
const char* p = reinterpret_cast<const char*>(&item) sizeof(item)-1;
for( size_t i=0; i<sizeof(item); i )
out.write( p--, 1 );
@@ -88,9 88,9 @@ namespace gdf
template<typename T>
void readLittleEndian( std::istream &in, T &item )
{
-#if defined(BOOST_LITTLE_ENDIAN)
#if BOOST_ENDIAN_LITTLE_BYTE
in.read( reinterpret_cast<char*>(&item), sizeof(item) );
-#elif defined(BOOST_BIG_ENDIAN)
#elif BOOST_ENDIAN_BIG_BYTE
char* p = reinterpret_cast<char*>(&item) sizeof(item)-1;
for( size_t i=0; i<sizeof(item); i )
in.read( p--, 1 );
|