Skip to content

Commit ef8cdd8

Browse files
mat8913sapier
authored and
sapier
committedJun 20, 2014
Fix build on big endian architectures.
1 parent 2dd69a8 commit ef8cdd8

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed
 

Diff for: ‎src/cguittfont/irrUString.h

+17-16
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <stdio.h>
4242
#include <string.h>
4343
#include <stdlib.h>
44+
#include <endian.h>
4445

4546
#ifdef USTRING_CPP0X
4647
# include <utility>
@@ -806,7 +807,7 @@ class ustring16
806807
ustring16()
807808
: array(0), allocated(1), used(0)
808809
{
809-
#if __BIG_ENDIAN__
810+
#if __BYTE_ORDER == __BIG_ENDIAN
810811
encoding = unicode::EUTFE_UTF16_BE;
811812
#else
812813
encoding = unicode::EUTFE_UTF16_LE;
@@ -820,7 +821,7 @@ class ustring16
820821
ustring16(const ustring16<TAlloc>& other)
821822
: array(0), allocated(0), used(0)
822823
{
823-
#if __BIG_ENDIAN__
824+
#if __BYTE_ORDER == __BIG_ENDIAN
824825
encoding = unicode::EUTFE_UTF16_BE;
825826
#else
826827
encoding = unicode::EUTFE_UTF16_LE;
@@ -834,7 +835,7 @@ class ustring16
834835
ustring16(const string<B, A>& other)
835836
: array(0), allocated(0), used(0)
836837
{
837-
#if __BIG_ENDIAN__
838+
#if __BYTE_ORDER == __BIG_ENDIAN
838839
encoding = unicode::EUTFE_UTF16_BE;
839840
#else
840841
encoding = unicode::EUTFE_UTF16_LE;
@@ -849,7 +850,7 @@ class ustring16
849850
ustring16(const std::basic_string<B, A, Alloc>& other)
850851
: array(0), allocated(0), used(0)
851852
{
852-
#if __BIG_ENDIAN__
853+
#if __BYTE_ORDER == __BIG_ENDIAN
853854
encoding = unicode::EUTFE_UTF16_BE;
854855
#else
855856
encoding = unicode::EUTFE_UTF16_LE;
@@ -863,7 +864,7 @@ class ustring16
863864
ustring16(Itr first, Itr last)
864865
: array(0), allocated(0), used(0)
865866
{
866-
#if __BIG_ENDIAN__
867+
#if __BYTE_ORDER == __BIG_ENDIAN
867868
encoding = unicode::EUTFE_UTF16_BE;
868869
#else
869870
encoding = unicode::EUTFE_UTF16_LE;
@@ -882,7 +883,7 @@ class ustring16
882883
ustring16(const char* const c)
883884
: array(0), allocated(0), used(0)
884885
{
885-
#if __BIG_ENDIAN__
886+
#if __BYTE_ORDER == __BIG_ENDIAN
886887
encoding = unicode::EUTFE_UTF16_BE;
887888
#else
888889
encoding = unicode::EUTFE_UTF16_LE;
@@ -897,7 +898,7 @@ class ustring16
897898
ustring16(const char* const c, u32 length)
898899
: array(0), allocated(0), used(0)
899900
{
900-
#if __BIG_ENDIAN__
901+
#if __BYTE_ORDER == __BIG_ENDIAN
901902
encoding = unicode::EUTFE_UTF16_BE;
902903
#else
903904
encoding = unicode::EUTFE_UTF16_LE;
@@ -912,7 +913,7 @@ class ustring16
912913
ustring16(const uchar8_t* const c)
913914
: array(0), allocated(0), used(0)
914915
{
915-
#if __BIG_ENDIAN__
916+
#if __BYTE_ORDER == __BIG_ENDIAN
916917
encoding = unicode::EUTFE_UTF16_BE;
917918
#else
918919
encoding = unicode::EUTFE_UTF16_LE;
@@ -926,7 +927,7 @@ class ustring16
926927
ustring16(const char c)
927928
: array(0), allocated(0), used(0)
928929
{
929-
#if __BIG_ENDIAN__
930+
#if __BYTE_ORDER == __BIG_ENDIAN
930931
encoding = unicode::EUTFE_UTF16_BE;
931932
#else
932933
encoding = unicode::EUTFE_UTF16_LE;
@@ -940,7 +941,7 @@ class ustring16
940941
ustring16(const uchar8_t* const c, u32 length)
941942
: array(0), allocated(0), used(0)
942943
{
943-
#if __BIG_ENDIAN__
944+
#if __BYTE_ORDER == __BIG_ENDIAN
944945
encoding = unicode::EUTFE_UTF16_BE;
945946
#else
946947
encoding = unicode::EUTFE_UTF16_LE;
@@ -954,7 +955,7 @@ class ustring16
954955
ustring16(const uchar16_t* const c)
955956
: array(0), allocated(0), used(0)
956957
{
957-
#if __BIG_ENDIAN__
958+
#if __BYTE_ORDER == __BIG_ENDIAN
958959
encoding = unicode::EUTFE_UTF16_BE;
959960
#else
960961
encoding = unicode::EUTFE_UTF16_LE;
@@ -968,7 +969,7 @@ class ustring16
968969
ustring16(const uchar16_t* const c, u32 length)
969970
: array(0), allocated(0), used(0)
970971
{
971-
#if __BIG_ENDIAN__
972+
#if __BYTE_ORDER == __BIG_ENDIAN
972973
encoding = unicode::EUTFE_UTF16_BE;
973974
#else
974975
encoding = unicode::EUTFE_UTF16_LE;
@@ -982,7 +983,7 @@ class ustring16
982983
ustring16(const uchar32_t* const c)
983984
: array(0), allocated(0), used(0)
984985
{
985-
#if __BIG_ENDIAN__
986+
#if __BYTE_ORDER == __BIG_ENDIAN
986987
encoding = unicode::EUTFE_UTF16_BE;
987988
#else
988989
encoding = unicode::EUTFE_UTF16_LE;
@@ -996,7 +997,7 @@ class ustring16
996997
ustring16(const uchar32_t* const c, u32 length)
997998
: array(0), allocated(0), used(0)
998999
{
999-
#if __BIG_ENDIAN__
1000+
#if __BYTE_ORDER == __BIG_ENDIAN
10001001
encoding = unicode::EUTFE_UTF16_BE;
10011002
#else
10021003
encoding = unicode::EUTFE_UTF16_LE;
@@ -1010,7 +1011,7 @@ class ustring16
10101011
ustring16(const wchar_t* const c)
10111012
: array(0), allocated(0), used(0)
10121013
{
1013-
#if __BIG_ENDIAN__
1014+
#if __BYTE_ORDER == __BIG_ENDIAN
10141015
encoding = unicode::EUTFE_UTF16_BE;
10151016
#else
10161017
encoding = unicode::EUTFE_UTF16_LE;
@@ -1029,7 +1030,7 @@ class ustring16
10291030
ustring16(const wchar_t* const c, u32 length)
10301031
: array(0), allocated(0), used(0)
10311032
{
1032-
#if __BIG_ENDIAN__
1033+
#if __BYTE_ORDER == __BIG_ENDIAN
10331034
encoding = unicode::EUTFE_UTF16_BE;
10341035
#else
10351036
encoding = unicode::EUTFE_UTF16_LE;

0 commit comments

Comments
 (0)
Please sign in to comment.