summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-17 10:42:37 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-17 10:42:37 +0100
commite625a440a4d17826677608ac430660374d2b7d4f (patch)
tree9f931f379339b0a6992667949158dc9a18457312
parent34c254f64b5a5d52cdca94080089e4ef2bcf7b5c (diff)
Don't assume sal_Unicode is unsigned short
Change-Id: Idcfa500c491fcedfff7d4c6e1bef25fd2d948d36
-rw-r--r--tools/source/stream/stream.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 6ad0a06e0bcf..c0198046761c 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -127,6 +127,8 @@ inline static void SwapDouble( double& r )
}
#endif
+static void SwapUnicode(sal_Unicode & r) { r = OSL_SWAPWORD(r); }
+
//SDO
#define READNUMBER_WITHOUT_SWAP(datatype,value) \
@@ -609,7 +611,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
for( j = n = 0; j < nLen ; ++j )
{
if (m_isSwap)
- SwapUShort( buf[n] );
+ SwapUnicode( buf[n] );
c = buf[j];
if ( c == '\n' || c == '\r' )
{
@@ -651,7 +653,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
sal_Unicode cTemp;
Read( &cTemp, sizeof(cTemp) );
if (m_isSwap)
- SwapUShort( cTemp );
+ SwapUnicode( cTemp );
if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
Seek( nOldFilePos );
}
@@ -729,7 +731,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr,
const sal_Unicode* const pStop = pTmp + nLen;
while ( p < pStop )
{
- SwapUShort( *p );
+ SwapUnicode( *p );
p++;
}
nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) );