Skip to content
Snippets Groups Projects
Commit 25389e35 authored by Roger Leigh's avatar Roger Leigh
Browse files

XERCESC-2208: Add special cases for C++11 character types

parent 2401d2b4
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,12 @@ public: ...@@ -38,6 +38,12 @@ public:
return XMLCh(((toSwap >> 8) | (toSwap << 8)) & 0xFFFF); return XMLCh(((toSwap >> 8) | (toSwap << 8)) & 0xFFFF);
} }
static inline UTF16Ch swapBytes(const UTF16Ch toSwap)
{
//The mask is required to overcome a compiler error on solaris
return XMLCh(((toSwap >> 8) | (toSwap << 8)) & 0xFFFF);
}
static inline unsigned int swapBytes(const XMLUInt32 toSwap) static inline unsigned int swapBytes(const XMLUInt32 toSwap)
{ {
return return
...@@ -49,6 +55,16 @@ public: ...@@ -49,6 +55,16 @@ public:
); );
} }
static inline UCS4Ch swapBytes(const UCS4Ch toSwap)
{
return
(
(toSwap >> 24)
| (toSwap << 24)
| ((toSwap & 0xFF00) << 8)
| ((toSwap & 0xFF0000) >> 8)
);
}
protected : protected :
......
...@@ -156,7 +156,7 @@ XMLUTF16Transcoder::transcodeTo(const XMLCh* const srcData ...@@ -156,7 +156,7 @@ XMLUTF16Transcoder::transcodeTo(const XMLCh* const srcData
for (XMLSize_t index = 0; index < countToDo; index++) for (XMLSize_t index = 0; index < countToDo; index++)
{ {
// To avoid flakey compilers, use a temp // To avoid flakey compilers, use a temp
const UTF16Ch tmpCh = UTF16Ch(*srcPtr++); const UTF16Ch tmpCh = static_cast<UTF16Ch>(*srcPtr++);
*outPtr++ = BitOps::swapBytes(tmpCh); *outPtr++ = BitOps::swapBytes(tmpCh);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment