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