1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:23:54 +00:00

fix for gcc not handling static constant initialized in class definition

This commit is contained in:
Nathan Jeffords 2013-02-01 22:48:13 -08:00
parent 718af692c9
commit 6e7c9ebbe6

View file

@ -10,7 +10,8 @@ public:
typedef uint32_t unicode_char; typedef uint32_t unicode_char;
typedef unsigned char const * point; typedef unsigned char const * point;
static const unicode_char sBadChar = 0xFFFFFFFF; //static const unicode_char sBadChar = 0xFFFFFFFF; gcc can't handle this
static unicode_char sBadChar () { return unicode_char (0xFFFFFFFF); }
utf8_stream (point begin, point end) : utf8_stream (point begin, point end) :
cur (begin), nxt (begin), end (end) cur (begin), nxt (begin), end (end)
@ -62,17 +63,17 @@ public:
boost::tie (octets, chr) = octet_count (*cur++); boost::tie (octets, chr) = octet_count (*cur++);
if (octets > 5) if (octets > 5)
return std::make_pair (sBadChar, cur); return std::make_pair (sBadChar(), cur);
auto eoc = cur + octets; auto eoc = cur + octets;
if (eoc > end) if (eoc > end)
return std::make_pair (sBadChar, cur); return std::make_pair (sBadChar(), cur);
while (cur != eoc) while (cur != eoc)
{ {
if ((*cur & 0xC0) != 0x80) // check continuation mark if ((*cur & 0xC0) != 0x80) // check continuation mark
return std::make_pair (sBadChar, cur);; return std::make_pair (sBadChar(), cur);;
chr = (chr << 6) | unicode_char ((*cur++) & 0x3F); chr = (chr << 6) | unicode_char ((*cur++) & 0x3F);
} }